/// <summary> /// Calculate baked path points /// </summary> public void UpdateSpacedPoints() { if (item.values.pathLerpMode != PathLerpMode.baked) { return; } spacedPoints = TSSPathBase.GetSpacedPoints(points.ToArray(), spacing, resolution); }
public Vector3 EvaluatePosition(float time) { if (item.values.pathLerpMode == PathLerpMode.baked) { return(ToWorld(TSSPathBase.EvaluateSpacedPath(spacedPoints, Mathf.Clamp01(time)))); } return(ToWorld(TSSPathBase.EvaluateCubicPath(points, Mathf.Clamp01(time)))); }
private static Vector3[] ToWorld(TSSPath path, Vector3[] localPoints) { Vector3[] worldPoints = new Vector3[localPoints.Length]; for (int i = 0; i < worldPoints.Length; i++) { worldPoints[i] = TSSPathBase.ToWorld(path, localPoints[i]); } return(worldPoints); }
private void AddSplitPoint() { if (selectedSegmentID == -1) { AddPointToEnd(); } Vector3[] segmentPoints = ToWorld(path.GetSegmentPoints(selectedSegmentID)); AddSplitPoint(ToLocal(TSSPathBase.EvaluateSegment(segmentPoints[0], segmentPoints[3], segmentPoints[1], segmentPoints[2], 0.5f))); }
public Quaternion EvaluateRotation(float time, Vector3 aligmentVector) { Quaternion evaluatedRotation = Quaternion.identity; if (item.values.pathLerpMode == PathLerpMode.baked) { evaluatedRotation = TSSPathBase.EvaluateSpacedRotation(spacedPoints, loop, aligmentVector.normalized, Mathf.Clamp01(time)); } else { evaluatedRotation = TSSPathBase.EvaluateCubicRotation(points, aligmentVector.normalized, Mathf.Clamp01(time)); } return(ToWorld(Quaternion.Euler(Mathf.Lerp(item.transform.localRotation.eulerAngles.x, evaluatedRotation.eulerAngles.x, item.rotationMask.x), Mathf.Lerp(item.transform.localRotation.eulerAngles.y, evaluatedRotation.eulerAngles.y, item.rotationMask.y), Mathf.Lerp(item.transform.localRotation.eulerAngles.z, evaluatedRotation.eulerAngles.z, item.rotationMask.z)))); }
public void Reset() { Init(); points = TSSPathBase.GetDefaultPath(this); resolution = 1; spacing = 10; loop = false; auto = true; UpdateSpacedPoints(); pointsAttach = new List <Transform>(); if (item.values.pathLerpMode == PathLerpMode.dynamic) { pointsAttach.Add(null); pointsAttach.Add(null); } }
private Quaternion ToLocal(Quaternion worldRotation) { return(TSSPathBase.ToLocal(this, worldRotation)); }
private Quaternion ToWorld(Quaternion localRotation) { return(TSSPathBase.ToWorld(this, localRotation)); }
private Vector3 ToWorld(Vector3 localPoint) { return(TSSPathBase.ToWorld(this, localPoint)); }
private Vector3 ToLocal(Vector3 worldPoint) { return(TSSPathBase.ToLocal(this, worldPoint)); }