Guest User

Bezier Curve example

a guest
May 31st, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class BezierExample : MonoBehaviour {
  5.     public GameObject prefab;
  6.     public GameObject start;
  7.     public GameObject objectForCurveNearStart;
  8.     public GameObject objectForCurveNearTarget;
  9.     public GameObject target;
  10.     // Use this for initialization
  11.     void Start () {
  12.         var bez = new Bezier(start.transform.position, objectForCurveNearStart.transform.position, objectForCurveNearTarget.transform.position, target.transform.position);
  13.         bez.CalculatePoints(10);
  14.         foreach (Vector3 point in bez.points)
  15.         {
  16.             Debug.Log(point);
  17.             Instantiate(prefab, point, Quaternion.identity);
  18.         }
  19.        
  20.     }
  21.    
  22.     // Update is called once per frame
  23.     void Update () {
  24.    
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment