Search Unity

Trigger (And collision) events with Unity Physics.

Discussion in 'DOTS Physics' started by Deleted User, Aug 16, 2019.

  1. Deleted User

    Deleted User

    Guest

    I have a moving physics shape and another static physics shape that is marked as trigger. The moving shape is moving towards the static one.
    How can I check for trigger events between these two?
    Also, how can I check for collision between two physics shapes?
     
  2. TRS6123

    TRS6123

    Joined:
    May 16, 2015
    Posts:
    190
    Use ITriggerEventsJob and ICollisionEventsJob
     
  3. Deleted User

    Deleted User

    Guest

    Thank you.
    Apparently these jobs execute over all entities. Right?
    Is there a way to filter entities? Like telling them to check trigger/collision for entities that have a specific component?
     
  4. Silenus3

    Silenus3

    Joined:
    Jun 5, 2019
    Posts:
    20
    maybe using a tag component ?
     
  5. TRS6123

    TRS6123

    Joined:
    May 16, 2015
    Posts:
    190
    The jobs iterate over all trigger/collision pairs in a particular frame. AFAIK there's no way to filter pairs without using conditional logic in the Execute method.
     
  6. TRS6123

    TRS6123

    Joined:
    May 16, 2015
    Posts:
    190
unityunity