- Home /
How can I prevent collider interpenetration?
I have an object containing a Rigidbody
, a CapsuleCollider
and a number of children each with their own collider. The object's rigidbody is set to "Freeze Rotation" and motion is restricted to the XY axis by calling rb.position = new Vector3(rb.position.x, rb.position.y, 0)
each update.
The problem is the main object's collider isn't stopped by some obstacles unless I first remove the childrens' colliders or change the rigidbody's center of mass via scripting: When the center of mass is high, colliders on top work OK but those at the bottom do not. When the center of mass is low, colliders at the bottom work OK but those on top do not. All the values I've tried so far lead to some of the colliders partially or completely penetrating the obstacles.
I don't see why the center of mass should affect collisions for objects where Freeze Rotation is set to true. Is there any way to prevent this from happening with Unity's built-in physics or do I have no choice but to write my own physics routines?
Answer by Adrian Lopez · Nov 04, 2010 at 05:22 AM
There doesn't seem to be any way around this using Unity's built-in physics, so I've filed this as a bug.
Your answer
Follow this Question
Related Questions
Why does this MeshCollider think it's half as thick? 2 Answers
When and when not to use kinematic rigidbody? 2 Answers
Do you have to have a rigidbody component for collision detection? 1 Answer
Preventing Convex Mesh Colliders from Interpenetrating 2 Answers
Raycaste vs trigger Colliders & Rigidbody performance 1 Answer