public static SimpleTransform Lerp(SimpleTransform a, SimpleTransform b, float t) { return(new SimpleTransform(Vector3.Lerp(a.position, b.position, t), Quaternion.Lerp(a.rotation, b.rotation, t), Vector3.Lerp(a.scale, b.scale, t), a.type)); }
/// <summary> /// Applies the position, rotation and local scale of the simple transform to the properties of the transform /// with their respective type. Only with scale their is just the local scale that is stored and will be set. /// </summary> /// <param name="transform">Transform that will be changed</param> /// <param name="sTransform">The simple transform that should be applied on the transform</param> /// <returns>Returns the changed transform. The transform is already changed, /// but out of convenience you can just keep on working with the transform</returns> public static Transform ApplySimpleTransform(this Transform transform, SimpleTransform sTransform) { switch (sTransform.Type) { case TransformType.World: transform.position = sTransform.Position; transform.rotation = sTransform.Rotation; transform.localScale = sTransform.Scale; break; case TransformType.Local: transform.localPosition = sTransform.Position; transform.localRotation = sTransform.Rotation; transform.localScale = sTransform.Scale; break; } return(transform); }
public static float Distance(SimpleTransform st, Vector3 v) { return(Vector3.Distance(st.Position, v)); }
public static float Distance(SimpleTransform a, SimpleTransform b) { return(Vector3.Distance(a.Position, b.Position)); }