Ejemplo n.º 1
0
 /// <summary>
 /// Calculate baked path points
 /// </summary>
 public void UpdateSpacedPoints()
 {
     if (item.values.pathLerpMode != PathLerpMode.baked)
     {
         return;
     }
     spacedPoints = TSSPathBase.GetSpacedPoints(points.ToArray(), spacing, resolution);
 }
Ejemplo n.º 2
0
        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))));
        }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 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)));
 }
Ejemplo n.º 5
0
        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))));
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
 private Quaternion ToLocal(Quaternion worldRotation)
 {
     return(TSSPathBase.ToLocal(this, worldRotation));
 }
Ejemplo n.º 8
0
 private Quaternion ToWorld(Quaternion localRotation)
 {
     return(TSSPathBase.ToWorld(this, localRotation));
 }
Ejemplo n.º 9
0
 private Vector3 ToWorld(Vector3 localPoint)
 {
     return(TSSPathBase.ToWorld(this, localPoint));
 }
Ejemplo n.º 10
0
 private Vector3 ToLocal(Vector3 worldPoint)
 {
     return(TSSPathBase.ToLocal(this, worldPoint));
 }