When colliding an entity created with a rigidbody and box collider with a static mesh collider entity at 100m/s, the actual collision seems to be detected prematurely, before the colliders intersect.
To illustrate the issue, I will compare Unity Physics (ECS) 1.2.4 with standard PhysX Physics.
- collision locations are displayed as red dots and collision normals are displayed in cyan
- both engines are set to run at 60Hz for comparability
- collision detection mode is discrete
Unity Physics:
PhysX:
Question:
Is there a way to configure Unity Physics to detect collisions at collider intersection and not before? The current behavior causes some unwanted issues.
Thanks. This PhysicsStep field seems to be available from Unity Physics 1.3.0+ (currently pre-release).
The collision tolerance specifies the minimum distance required for contacts between rigid bodies to be created.
The default value of CollisionTolerance is 0.01. Setting this to a negative value i.e. -0.1 resolves the issue but leads to the object not coming to rest on the ground for example. If set to a larger value than the default, the problem becomes more prominent which is to be expected.
Am I missing something here?
The contact is generated before a collision occurs for continuous collision detection modeling to prevent tunneling. The contact tolerance configures how far away contacts will be created from the surface for this purpose.
If you see the contact, that doesn’t mean there is any force applied. If the object would not actually hit the contact surface, despite the contact being created, it won’t add any force to the rigid body.
They fact that you can set a negative contact tolerance is actually a mistake. It should not be lower than zero.