BezierCurve
using UnityEngine; using System.Collections; public class Basier3 : MonoBehaviour { public Transform p1; public Transform p2; public Transform p3; public Transform p4; public Transform t1; public Transform t2; public Transform t3; public Transform m1; public Transform m2; public Transform n; private float t = 0; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (t < 1) { t1.position = p1.position + (p2.position - p1.position) * t; t2.position = p2.position + (p3.position - p2.position) * t; t3.position = p3.position + (p4.position - p3.position) * t; m1.position = t1.position + (t2.position - t1.position) * t; m2.position = t2.position + (t3.position - t2.position) * t; n.position = m1.position + (m2.position - m1.position) * t; t += Time.deltaTime * .1f; } else { t = 0; } } void OnDrawGizmos() { Gizmos.color = Color.red; Gizmos.DrawLine(p1.position,t1.position); Gizmos.color = Color.green; Gizmos.DrawLine(p2.position,t2.position); Gizmos.color = Color.blue; Gizmos.DrawLine(p3.position,t3.position); Gizmos.color = Color.yellow; Gizmos.DrawLine(t1.position,t2.position); Gizmos.DrawLine(t2.position,t3.position); Gizmos.DrawLine(m1.position,m2.position); } }