Ejemplo n.º 1
0
        public static Quaternion ReverseRotation(this AxisOrder target, CustomRotation relative, Quaternion?current = null)  //WORKS!
        {
            Quaternion newRot;

            if (current != null)
            {
                newRot = (Quaternion)current;
            }
            else
            {
                newRot = relative.rotation;
            }

            if (target.variety == SpaceVariety.OneSided)
            {
                for (int j = target.axes.Count; j > 0; j--)
                {
                    AxisApplied i = target.axes[j - 1];

                    newRot = relative.Rotate(newRot, (Vectors.axisDirections[i.axis] * -i.units), target.space);
                }
            }
            else if (target.variety == SpaceVariety.Mixed)
            {
                for (int j = target.axes.Count; j > 0; j--)
                {
                    AxisApplied i = target.axes[j - 1];

                    newRot = relative.Rotate(newRot, (Vectors.axisDirections[i.axis] * -i.units), i.space);
                }
            }

            return(newRot);
        }
Ejemplo n.º 2
0
        public static Quaternion ApplyRotation(this AxisOrder target, CustomRotation relative, Quaternion?current = null)  //WORKS!
        {
            Quaternion newRot;

            if (current != null)
            {
                newRot = (Quaternion)current;
            }
            else
            {
                newRot = relative.rotation;
            }

            if (target.variety == SpaceVariety.OneSided)
            {
                foreach (AxisApplied i in target.axes)
                {
                    newRot = relative.Rotate(newRot, (Vectors.axisDirections[i.axis] * i.units), target.space);
                }
            }
            else if (target.variety == SpaceVariety.Mixed)
            {
                foreach (AxisApplied i in target.axes)
                {
                    newRot = relative.Rotate(newRot, (Vectors.axisDirections[i.axis] * i.units), i.space);
                }
            }

            return(newRot);
        }