3D: "Continuous" Collision detection and constraints not working

Hi,

I’m developing a side-scrolling racing car. I set the “Collision Detection” mode of the car’s RigidBody to “Continous”, because it is a fast moving object. Additionally I set the constraints “Freeze Position” to “Z” and “Freeze Rotation” to “Y,Z”.

The problem is, that the constraints are not working correctly. Sometimes after a collision, the car begins to rotate in a forbidden direction.

When I set the CollisionDetectionMode to “Discrete” the constraints are working, but then the car sometimes moves into or through the ground, because it is too fast.

Trying to manipulate the Rotation transforms manually ends in the famous Gimbal lock problem.

Can someone help me? Is this a bug in Unity?

Thanks
Jus

How do you rotate when you do it manually? Do you use Quaternion.RotateAround method?

Vector3 eulerRotation = Car.transform.eulerAngles;
eulerRotation.y = 90;
eulerRotation.z = 0;
Car.transform.rotation = Quaternion.Euler(eulerRotation);

Try using Transform.RotateAround instead. The problem is probably that you convert from euler angles.

Sorry, but I don’t know what you mean. How can I use Transform.Rotate to apply the constraints to the y and z rotation?