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
- Saving moves Toggle Button Group buttons to the wrong place in hierarchy
- [iOS] Visual artifacts are visible when the camera's feed is rendered to a texture
- Error "cannot map expression to ps_4_0 instruction set" in Shader Graph preview when using the GATHER_RED_TEXTURE2D macro in custom hlsl function
- Sprite Renderer image is changed when Mask Interaction is turned by C# script
- URP Player remains in Windows Background processes when the application is closed
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.