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)); }
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); }
///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); }