Search Issue Tracker
By Design
Votes
0
Found in
2021.3.29f1
2022.3.7f1
2023.1.8f1
2023.2.0b4
Issue ID
UUM-45915
Regression
No
GameObjects Y axis always gradually aligns with the world space X, Y, or Z axis when manually calculating rotation using the "Animator.angularVelocity" property
Reproduction steps:
1. Open project “Repro.zip”
2. Open scene “Sample”
3. Enter Play Mode
4. Observe the characters through the Game view
Expected result: The characters always remain in the same position and rotation
Actual result: The characters gradually align with the world space X, Y, or Z axis (“player_animctrl_manual” and “player_animctrl_builtinthenmanual” GameObjects in the Hierarchy)
Reproducible with: 2021.3.29f1, 2022.3.7f1, 2023.1.8f1, 2023.2.0b4
Reproducible on: macOS Ventura 13.2.1 (Intel), Windows 10 (by the reporter)
Not reproducible on: No other environment tested
Notes:
- Also reproducible in Standalone Player
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
- [Search] Query Builder - uneditable NaN in Transform vectors
- Transform.rotation property is as a Vector4 Quaternion instead of a Vector3 field when using InspectorElement.FillDefaultInspector
- [Search] Query Builder - "Input String was not in a correct format" error when changing query options
- MacOS Xcode project build fails when a package has PrivacyManifest
- [IL2CPP] Crash when closing the Player while an exception is thrown during exception handling
Resolution Note:
The issue doesn't come from Animator.angularVelocity but from calling the wrong function in the user code :
{code:c#}
var rotationAngle = _animator.angularVelocity * Mathf.Rad2Deg * deltaTime;
transform.Rotate(rotationAngle, Space.World);
{code}
This version of transform.Rotate() takes euler angles as parameters and not an axis and an angle. The user can fix the issue by using the appropriate function that takes an axis and an angle instead :
{code:c#}
var deltaTime = Time.deltaTime / Time.timeScale; // Time.unscaledDeltaTime is not always accurate
var rotationAngle = _animator.angularVelocity * Mathf.Rad2Deg * deltaTime;
transform.Rotate(rotationAngle.normalized, rotationAngle.magnitude, Space.World);
{code}