-
Notifications
You must be signed in to change notification settings - Fork 10
TriggerComponent
The TriggerComponent is a component that allow to check if a RigidBodyComponent is inside it or not. As it's for the RigidBodyComponent it could be built on multiple shapes, but for simplicity right now there's only BoxTriggerComponent.
Once built and placed, you must check your own if a RigidBodyComponent is inside it. The best way to do it is placing a check on the update function.
The best example of this is in SimpleGame, that has the RespawnTrigger. The RespawnTrigger has a vector of RigidBodyComponent to check. Every frame it check if each one of them is inside or not. If a RigidBodyComponent is inside it check the GameObject name, if is a Crate it calls kill(), if is the player it calls respawn().
Notice: you know only when a RigidBodyComponent is inside or not. It's up to you to manage and keep the reference between the RigidBodyComponent and it's GameObject. Otherwise you can use:
SGameObject* SComponent::get_owner()
from any component.
This documentation describe only a small part of the engine, since it's not made to be used by a large amount of people.
If you would like to know more about a part of the engine, how to do something, or if a part of the documentation is not correct/out of date, please open an issue and tell me.
Thank you for reading the ScrapEngine Wiki!
Getting started
Engine structure
Using the Engine