Search Issue Tracker
Won't Fix
Votes
4
Found in
5.5.0p3
Issue ID
868124
Regression
No
RigidbodyConstraints are ignored when rotating object with some ForceMode's
RigidbodyConstraints related to rotation doesn't work correctly when trying to rotate object with some ForceMode's. A little bit of rotation is still applied even when constrains are enabled.
To reproduce:
1. Open project.
2. Inspect the script attached to gameobject in the scene.
rigidBody.constraints = RigidbodyConstraints.FreezeAll;
yield return new WaitForFixedUpdate();
rigidBody.AddRelativeTorque(new Vector3(0, 0.5f, 0), ForceMode.Acceleration);
yield return new WaitForFixedUpdate();
Debug.AssertFormat(rigidBody.angularVelocity == Vector3.zero, "{0}", rigidBody.angularVelocity.y);
3. Enter play mode.
Note: You can see in the inspector that the object rotates a little bit and then stops.
4. Exit play mode.
5. Comment line "rigidBody.constraints = RigidbodyConstraints.FreezeAll;".
6. Enter Play.
Note: You can see the same results even though constrains line is commented out.
Expected results: No rotation.
Actual results: Rotation occurs.
Important notes:
1. Same bug occurs when using "RigidbodyConstraints.FreezeRotation" instead of "RigidbodyConstraints.FreezeAll".
2. Same bug occurs when using "ForceMode.VelocityChange" instead of " ForceMode.Acceleration".
Reproduces with: 5.3.6f1; 5.4.3p3; 5.5.0p3; 5.6.0b3;
Comments (2)
-
katrinamain
Mar 17, 2023 10:36
Comment
-
big_3
Jun 13, 2017 20:43
I have the same problem. Did you find a Workaround?
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Editor crashes and a window with "GetManagerFromContext: pointer to object of manager 'MonoManager' is NULL (table index 5)" error is shown when launching a freshly created project
- Editor Windows dragging behavior is erratic/glitchy when a specific multi-display setup is used and the Editor window is not on the main display
- Meta Quest missing an icon in Build Profiles window in U6.0
- Foldout arrow indent is misaligned in the Inspector when used for Arrays or Lists
- Material import pipeline strips properties when it is added with a script
Resolution Note:
Rigidbody Constraints have some limitations that can't be easily solved. In such occasions it's recommended that Joints are used to lock the object instead.