Search Issue Tracker

By Design

Votes

0

Found in

2017.3.0f3

Issue ID

1036106

Regression

No

Rigidbody constrains do not work if the rigidbody has a child with a collider

Physics

-

To reproduce:

1. Open the project, attached by the user (ConstraintsTest.zip)
2. Open the "testscene" scene
3. Select the ItemLaser game object in the Hierarchy
4. Observe that it has Freeze Rotation X and Y set to true
5. Enter Play mode
6. Observe that the object still rotates around the frozen axes
7. (Optional) Disable the ItemLaser -> Laser object
8. In Play mode, observe that the constraints now have effect on the rigidbody

Expected: constraints have effect on the rigidbody no matter what

Reproduced in 2017.1.3p4, 2017.2.2p4, 2017.3.0f3, 2017.4.2f2, 2018.1.0f2, 2018.2.0b4, 2018.3.0a1

By design: FreezeRotation applies constraints in rigid body's local mass frame, which is not necessarily aligned with world frame. The project has a rigid body with 2 colliders. the second one (capsule) is off centre. This result in a local mass frame that has a non identity rotation w.r.t world frame.
To make things work as expected, try setting Rigidbody.inertiaTensorRotation to identity as showed in this page https://docs.unity3d.com/ScriptReference/Rigidbody-inertiaTensorRotation.html

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.