- Home /
Rigidbody 2D weird physics on kinematic rotate
So I have a pink platform which is a kinematic rigidbody 2D, and a bunch of dynamic cubes. The user is able to control the platform's rotation.
The problem is when rotating the platform, the cubes kind of react in a delay way. Instead of the bottom cubes pushing the top ones up, they sort of intersect with each other and just slide. The physics look totally wrong. Check the image above to see how it looks like when the platform rotates up.
Is this just rigidbody 2D being a bad solver or am I doing something wrong? Maybe I need to increase timesteps somewhere to get a better sim? I have no idea!
I am doing the rotating in FixedUpdated like so:
void FixedUpdate()
{
if (Input.GetKey("a"))
{
transform.Rotate(new Vector3(0, 0, 2f));
}
else if (Input.GetKey("d"))
{
transform.Rotate(new Vector3(0, 0, -2f));
}
}
Forget to mention I have Interpolate enabled on all objects, and using Continuous collision doesn't help.
The mesh itself doesn't have any sub-divisions, could that have an effect on the solver?
Answer by GreenCell · Jun 17, 2017 at 07:14 AM
I need to read the docs more carefully. Following this example seems to be working ok now.
https://docs.unity3d.com/ScriptReference/Rigidbody2D.MoveRotation.html