Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [Moved to Physics subforum] How to mix collision and triggers responses from sinle PhysicsShape?

Discussion in 'Entity Component System' started by Elapotp, Aug 18, 2022.

  1. Elapotp

    Elapotp

    Joined:
    May 14, 2014
    Posts:
    98
    Hi, helpful community!

    My question is about DOTS Physics and how correctly setup interaction of the entities.

    I have a PlayerBody prefab with a single gameobject that has:
    — PhysicsBody component (set to Dynamic)
    — PhysicsShape component with Collide collision response.

    Also I have 2 types of game elements — obstacles and health boosters.
    Obstacles are Static. HealthBoosters are Kinematic.

    The idea is to collide with Obstacles and trigger HealthBoosters.
    1. Is it possible to have a setup with a single PhysicsShape on PlayerBody to collide and trigger?
    2. How to correctly assign CollisionFilter (should the player's collision filter set CollidesWith to HealthBooster value, or it is enough to have that on HealthBooster itself)?
    3. Will I get 2 collision events, if both of the collided entities are set to CollideRaiseCollisionEvents?
     
  2. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    273
    Elapotp likes this.
  3. Elapotp

    Elapotp

    Joined:
    May 14, 2014
    Posts:
    98