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;
-
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
- Created asset is placed in a new folder when creating a new folder and instantly creating an asset by clicking somewhere else
- Selecting and deleting transition in Animator does not add to Undo History when animation is previewed in Inspector
- GameObjects remain static when updating constraints of PhysicsJoint with "Enable Sleeping" selected in Havok Physics Configuration
- [iOS] Touch input is not clocked and UI is unresponsive when the application is paused mid-drag without lifting the finger
- [sw-unity-6-1] Scene view renders any light differently when more than one camera exists and neither have the "MainCamera" tag
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.