Skip to content

Add TriggerArea #1246

@fallenatlas

Description

@fallenatlas

Identifies a collider as an area without physical collision that detects collisions with other areas and bodies., and emits signals for these events.

Current Design

Components:

  • Have a TriggerArea component
    • bool monitoring - if true the area is active, otherwise it doesn't detect any collisions
    • bool monitored - if true the area is detected by others
  • Needs only a CollisionShape and a Collider to work.
    The TriggerArea component should be defined in the CollisionsPlugin.

Events:

  • If a collision object has the TriggerArea component the following relations should be created between the area entity and the other entity:
    • OnAreaEntered/Exited, OnBodyEntered/Exited
    • OnArea - for when an object is in the area (equivalent to collidingWith rn, check if this is needed)
  • To read an event an entity needs to have an observer for the relation it wants to treat. This observer can technically be anywhere, its up to the developer, however, its probably best to be from the area side since usually its the area that determines the behavior (e.g. have an area handle plugin that implements a certain behavior for an area, and you can have different handle area plugins). Document this.

Other details:

  • We want to avoid computing ContactManifold for any entity with the TriggerArea component.
    • This means these entities only perform the basic collision test (SAT for boxes, ...)

We will want a new sample to demonstrate this.

Checklist

  • Create TriggerArea Component and add check to avoid computing contact manifold
  • Create event relations and create event functionality

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-EngineB-CollisionsP-UrgentThis issue is a big priority, and it would be good to close it ASAPS-Needs-DesignDemands some time designing an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions