Areas and Triggers

Overview

The entity system is capable of creating tracking area shapes, as well as entities that may enter them. This exposes the ability to receive callbacks when an entity enters an area in the world, usually used to trigger gameplay logic in specific sections of a level.

Access to the internal proximity grid is made possible by adding an instance of the IEntityTriggerComponent component to an entity, see the example below.

Once the trigger has been created on an entity, the ENTITY_EVENT_ENTERAREA and ENTITY_EVENT_LEAVEAREA events will be automatically fired on any entity that has not set the ENTITY_FLAG_NO_PROXIMITY flag.

Conclusion

This concludes the article on areas and triggers, you may be interested in: