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
- Memory leak when a lot of UI elements are spawned and despawned
- Warnings are not logged in the Console window when using external code analyzers
- Errors “TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations, size 288“ appear constantly when Prefab is open
- Crash on PPtr<Shader>::operator or NullException errors spammed in console when calling Dispose() on null GraphicsBuffer with baked Reflection Probes
- “EndRenderPass: Not inside a Renderpass” and other Render Graph errors in the Player when Render Graph is enabled and Overlay UI is used
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.