Beispiel #1
0
        void Update()
        {
            angle = Time.deltaTime * speed;
            Vector3 closestPoint = Utility.ClosestPointOnLineSegment(smoothLine.Nodes[1], smoothLine.Nodes[0], smoothLine.Nodes[2]);
            Vector3 axis         = smoothLine.Nodes[2] - smoothLine.Nodes[0];
            Vector3 newPoint     = closestPoint + Quaternion.AngleAxis(speed, axis) * (smoothLine.Nodes[1] - closestPoint);

            Vector3 node2 = smoothLine.Nodes[2];

            node2.x = Mathf.PingPong(Time.time * 2, 10) - 5;
            smoothLine.UpdateNode(2, node2);
            smoothLine.UpdateNode(1, newPoint);
            smoothLine.UpdateWhenPathChanges();
        }
 void DoNodesAnim()
 {
     for (int i = 0; i < defaultNodes.Length; i++)
     {
         Vector3 newPos = defaultNodes[i];
         newPos.y = defaultNodes[i].y + Mathf.PingPong(Time.time * .4f * (i + 1), 1.5f);
         smoothLine.UpdateNode(i, newPos);
     }
     smoothLine.UpdateWhenPathChanges();
 }