Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Issue with Compound Colliders and Triggers

Discussion in 'Physics for ECS' started by mattdymott, Jan 21, 2020.

  1. mattdymott

    mattdymott

    Joined:
    Dec 27, 2016
    Posts:
    29
    I have been using the code from the PhysicsSamples that allows Triggers to have extra information about whether a DynamicBody has Entered or Exited a TriggerVolume. This works when the DynamicBody has just one PhysicsShape attached but when a child PhysicsShape is attached (which will result in a CompoundCollider) the Overlapped component which is added to the DynamicBody on Entering the TriggerVolume keeps on getting removed and then added again. I have trawled through the code (which I modified) to find the issue but haven't been able to resolve it. I have also downloaded the PhysicsSamples the see if the issue is present in them and it is. The sample I'm referring too is under Demos/Setup/Events. I used the ChangeMaterial demo, modified the Sphere DynamicBody to have a child PhysicsShape and then stepped through in the UnityEditor till when the Sphere enters the Box Trigger. The Overlapped component is continually added and removed until the Sphere leaves the Trigger. This doesn't happen if it's a single PhysicsShape attached.
    Any help on how to resolve this issue will be appreciated.
    Thanks