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 DoAnim() { smoothLine.transform.Rotate(Vector3.right * Time.deltaTime * 20); smoothLine.UpdateAllNodeWithTransform(); // smoothLine.ConvertToSmoothCurve(); //smoothline nesnesinin rotasyonu ve posizyonu ile oynanırsa "UpdateWhenPathChanges" yerine buda çağrılabilir 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(); }
private void OnDrawGizmosSelected() { if (autoUpdate) { smoothLine.UpdateWhenPathChanges(); } Gizmos.color = Color.yellow; float stepPercent = 1f / numObject; for (int i = 0; i < numObject; i++) { Vector3 pos = smoothLine.GetPointAtTime(stepPercent * i);; Gizmos.DrawSphere(pos, radius); } }