Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug CompoundCollider Filter doesn't update anymore at runtime

Discussion in 'Physics for ECS' started by argibaltzi, Nov 11, 2020.

  1. argibaltzi


    Nov 13, 2014
    I am trying to change the collision filter of a collider at runtime but it doesn't seem to work anymore....

    I noticed that some collisions are disabled but some are still enabled, is this a bug? in the previous physics version i could change the filter just fine

    Code (CSharp):
    1. Entities
    2.                .WithBurst()
    3.                .ForEach((ref PhysicsCollider collider) =>
    4.                {
    5.                          collider.Value.Value.Filter = CollisionFilter.Zero;
    7.                }).Run();
    the colliders were made with material templates if it makes any difference

    simple box colliders seem to get disabled in the scene and do not collide with anything as expected in this test

    the collider.Value.Value.Filter in the compound colliders does not change after i set a new value
  2. steveeHavok


    Mar 19, 2019
    TLDR, a fix is coming.

    For the next release we are trying to make tweaking CollisionFilter much easier, especially for compound Colliders. Case in point, check out this thread related to MeshColliders.
    Similar issues arise for CompoundColliders as well as MeshColliders. The Filter on the top level of the CompoundCollider is only really a getter for the union of all the Filters of the ChildColliders. So changing the top level Filter on a Compound doesn't do anything. You really need to tweak the Filters of the children, and even then you really need to tweak the Unity Physics code to update the Filter at the top level (i.e. as described for MeshColliders here).
    petarmHavok and argibaltzi like this.