コード例 #1
0
        public static Quaternion TransformRotation(this IDirectable directable, Vector3 euler, TransformSpace space)
        {
            var t = directable.GetSpaceTransform(space);

            if (t != null)
            {
                return(t.rotation * Quaternion.Euler(euler));
            }
            return(Quaternion.Euler(euler));
        }
コード例 #2
0
        public static Vector3 InverseTransformRotation(this IDirectable directable, Quaternion rot, TransformSpace space)
        {
            var t = directable.GetSpaceTransform(space);

            if (t != null)
            {
                return((Quaternion.Inverse(t.rotation) * rot).eulerAngles);
            }
            return(rot.eulerAngles);
        }
コード例 #3
0
        ///Inverse Transforms a point in specified space
        public static Vector3 InverseTransformPosition(this IDirectable directable, Vector3 point, TransformSpace space)
        {
            var t = directable.GetSpaceTransform(space);

            return(t != null?t.InverseTransformPoint(point) : point);
        }