đRotator
Stabilizes Euler rotations for smooth interpolation
Last updated
Stabilizes Euler rotations for smooth interpolation
Last updated
Unity calculates rotation using quaternions which when converting to and from Euler angles may cause data loss resulting in inadvertent flipping or collapsing multiple rotations into a partial one.
Normally, a user sets an object's rotation in the Transform editor and all appears to be fine.
However, when this value is accessed via script as shown below, it returns a different value:
This is particularly problematic for scripts which read and modify rotation values during Update.
Rotator solves the problem by storing Euler values separately in a simple component so that it does not rely on getting Euler angles from the Transform. This allows rotations to have any value desired and maintains continuity in animations.
Please note that when Rotator is active, it is no longer possible to directly set the Euler angles in the Transform, since Rotator is controlling it. Instead, use the Rotator editor as shown above to set rotation.
The Rotator component is applied automatically whenever animating an object's rotation.
When enabled, Euler angles are applied in world space rather than local space. This may be enabled automatically by behaviors that require world space rotation, such as Look At.
This option should be enabled for any object with a Rigidbody component to interact with physics. When enabled, rotation is applied using Rigidbody.MoveRotation.
Rotator has been built into the AxonGenesisBehavior base class for easier access and setup throughout scripts in Timeflow. Please see Rotator.cs for more info.
Additional commands can be found by clicking the 3 dotted menu on the right side of the inspector.
Applies a 180 degree rotation to the selected axis, or all axes. Use this to flip the orientation of the rotation.
Multiplies the axis rotation by -1 to reverse the direction of rotation.
Applies rounding to each axis value, converting them to integer values.
This constrains rotations to the selected amount of degrees. Instead of clamping values, this wraps the values within the range (negative to positive).