public static Transform Interpolate(Transform t1, Transform t2, float blendFactor) { return new Transform( Quaternion.Slerp(t1.Rotation, t2.Rotation, blendFactor), Vector3.Lerp(t1.Translation, t2.Translation, blendFactor) ); }
public static void Invert(ref Transform t) { Vector3 v; Quaternion.Conjugate(ref t.Rotation, out t.Rotation); Vector3.Transform(ref t.Translation, ref t.Rotation, out v); t.Translation = -v; }
public static void Multiply(ref Transform t1, ref Transform t2, out Transform t) { Vector3 temp; Vector3.Transform(ref t2.Translation, ref t1.Rotation, out temp); Vector3.Add(ref temp, ref t1.Translation, out t.Translation); Quaternion.Multiply(ref t1.Rotation, ref t2.Rotation, out t.Rotation); Quaternion.Normalize(ref t.Rotation, out t.Rotation); }