Skip to main content

RotationOverrider

A class in Root.Township, the global namespace.

After a LimbIK solve, copies a target's world rotation onto a bone, optionally clamped by its RotationLimitAngle. Needs a LimbIK on the same object.

Constructors​

MemberWhat it is
RotationOverrider()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

6 private and internal fields
MemberWhat it is
private IKSolver ikSolverThe IK solver whose post-update triggers the override. Replaced in Awake with the LimbIK solver.
private bool isUsingRotationLimitWhether to clamp with the RotationLimitAngle. Default true.
private RotationLimitAngle rotationLimitRotationLimitAngle on the overridden transform, if any.
private Transform targetTransform whose world rotation is copied.
private GameObject testUnused object reference.
private Transform transformToOverrideThe bone to rotate. Null means this object's transform.

Methods​

5 private and internal methods
MemberWhat it is
private void Awake()Defaults the overridden transform to its own, gets the IK solver from LimbIK and finds the rotation limit.
private void OnDisable()Unhooks UpdateRotation from the solver's post-update.
private void OnDrawGizmos()Empty.
private void OnEnable()Hooks UpdateRotation to the solver's post-update.
private void UpdateRotation()Sets the transform's rotation to the target's, then applies the rotation limit if enabled.