Search Unity

Bug Mesh collider does not respect inverted normals (to represent enclosing boundry).

Discussion in 'Physics for ECS' started by norlesh, Mar 14, 2023.

  1. norlesh

    norlesh

    Joined:
    Feb 10, 2019
    Posts:
    5
    Attempted to use an inverted sphere (normals flipped inside blender) as a mesh collider so I could have bodies colliding with the inside wall of a sphere but does not seem to work (falls straight through); this hack was reported to work for the old physics system (see the discussion at https://forum.unity.com/threads/can-you-invert-a-sphere-or-box-collider.118733/ among others) - is there an alternative solution or am I going to need to implement a custom job to account for the boundary collisions?
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    OH! Sorry, please ignore this reply. I didn't realize I was in the ECS forum.

    For that to work, the inverted sphere collider must not be associated to a Rigidbody (no Rigidbody in its GameObject nor in any of its parents) and the collider must not be marked as Convex.

    If you also want to move the inverted sphere while causing correct physics effects to the objects inside, then every face of the sphere must be an independent collider marked as Convex. All of them must be children of a Rigidbody marked as Kinematic, and this rigidbody must be moved with Rigidbody.MovePosition and Rigidbody.MoveRotation from FixedUpdate.
     
    Last edited: Mar 14, 2023
  3. Endlesser

    Endlesser

    Joined:
    Nov 11, 2015
    Posts:
    89
    Makes it two
     
  4. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    278
    If you tell me where to, I could probably move this thread for you. Let me know.