Search Unity

Resolved Physics 0.50 - Mesh Collider created at runtime is not working

Discussion in 'Physics for ECS' started by LuisEGV, Mar 29, 2022.

  1. LuisEGV

    LuisEGV

    Joined:
    Jul 21, 2015
    Posts:
    36
    Hello. I'm working on a procedural terrain mesh, using the Entities and Physics packages. I just updated those packages to the 0.50 version which caused the terrain colliders to stop interacting with the physics system. No collisions, no cast detections, nothing.

    I'm not sure whether is correct to assume this is a bug. It's possible that there is just some configuration I'm ignoring, but I can't find anything about that in the docs.

    So, is there a new way to create Mesh colliders at runtime or something else I'm ignoring about the new Entities / Physics packages that is affecting the colliders generation or simulation?

    (This is the code I currently use to create the collider)

    Code (CSharp):
    1. var colliderRef = MeshCollider.Create(verts, triangles, filter);
    2. ECB.AddComponent(entityInQueryIndex, entity, new PhysicsCollider { Value = colliderRef });
     
  2. davidus2010

    davidus2010

    Joined:
    Dec 4, 2017
    Posts:
    72
    Hi, i ran into a similar issue when upgrading. Adding a "PhysicsWorldIndex" component to the entity should fix it.
    From what i understand, this is intended behaviour with 0.50. Not having a PhysicsWorldIndex on an entity is the equivalent of previously adding a PhysicsExclude component.
     
    Egad_McDad, Shinyclef and LuisEGV like this.
  3. LuisEGV

    LuisEGV

    Joined:
    Jul 21, 2015
    Posts:
    36
    Thank you so much! it works now.

    BTW, are you Orbis Terrain developer?