public void SetRotation(RigidBoneSystemInputs inputs, Quaternion objectSpaceRotation, bool applyClamp = false)
    {
        Quaternion orientatedSpaceRotation = orientationSpace.TransformToOrientedSpace(objectSpaceRotation);
        TwistSwing orientedSpaceTwistSwing = TwistSwing.Decompose(RotationOrder.TwistAxis, orientatedSpaceRotation);

        SetOrientedSpaceRotation(inputs, orientedSpaceTwistSwing, applyClamp);
    }
    private Matrix3x3 GetCombinedScale(ChannelOutputs outputs)
    {
        Vector3 scale              = Scale.GetValue(outputs);
        float   generalScale       = (float)GeneralScale.GetValue(outputs);
        var     objectSpaceScaling = Matrix3x3.Scaling(scale * generalScale);

        OrientationSpace orientationSpace = GetOrientationSpace(outputs);
        var orientedSpaceScaling          = orientationSpace.TransformToOrientedSpace(objectSpaceScaling);

        return(orientedSpaceScaling);
    }
    public Vector3 ConvertRotationToAngles(ChannelOutputs orientationOutputs, Quaternion objectSpaceRotation, bool applyClamp)
    {
        OrientationSpace orientationSpace         = GetOrientationSpace(orientationOutputs);
        Quaternion       orientatedSpaceRotationQ = orientationSpace.TransformToOrientedSpace(objectSpaceRotation);
        TwistSwing       orientatedSpaceRotation  = TwistSwing.Decompose(RotationOrder.TwistAxis, orientatedSpaceRotationQ);

        if (applyClamp)
        {
            orientatedSpaceRotation = RotationConstraint.Clamp(orientatedSpaceRotation);
        }

        Vector3 rotationAnglesRadians = RotationOrder.ToTwistSwingAngles(orientatedSpaceRotation);
        Vector3 rotationAnglesDegrees = MathExtensions.RadiansToDegrees(rotationAnglesRadians);

        return(rotationAnglesDegrees);
    }