public static Matrix CatmullRomLerpUnclamped(Matrix target, Matrix pre, Matrix start, Matrix end, float t) { var crusher = end.crusher; target.crusher = crusher; target.position = CatmulRom.CatmullRomLerp(pre.position, start.position, end.position, t); var rotcrusher = crusher.RotCrusher; if (crusher != null && rotcrusher != null && rotcrusher.TRSType == TRSType.Quaternion) { target.rotation = Quaternion.SlerpUnclamped((Quaternion)start.rotation, (Quaternion)end.rotation, t); } else { var srot = (Vector3)start.rotation; var erot = (Vector3)end.rotation; var ydelta = srot.y - erot.y; var zdelta = srot.z - erot.z; Vector3 unfucked = new Vector3( erot.x, ydelta > 180 ? erot.y + 360 : ydelta < -180 ? erot.y - 360 : erot.y, zdelta > 180 ? erot.z + 360 : zdelta < -180 ? erot.z - 360 : erot.z ); target.rotation = Vector3.Lerp(srot, (Vector3)unfucked, t); } target.scale = CatmulRom.CatmullRomLerp(pre.scale, start.scale, end.scale, t); return(target); }
public static Matrix CatmullRomLerpUnclamped(Matrix target, Matrix pre, Matrix start, Matrix end, float t) { var crusher = end.crusher; target.crusher = crusher; target.position = CatmulRom.CatmullRomLerp(pre.position, start.position, end.position, t); var rotcrusher = crusher.RotCrusher; if (crusher != null && rotcrusher != null && rotcrusher.TRSType == TRSType.Quaternion) { target.rotation = Quaternion.SlerpUnclamped((Quaternion)start.rotation, (Quaternion)end.rotation, t); } else { target.rotation = Vector3.SlerpUnclamped((Vector3)start.rotation, (Vector3)end.rotation, t); } target.scale = CatmulRom.CatmullRomLerp(pre.scale, start.scale, end.scale, t); return(target); }