hello.

i’m doing a practice with bazier curve, by folow a tutorial i was able to get a cruved linerenderer, but what i want to do is to move an object by a curve, and here’s the point… how to do it, is fine to just put Time.deltatime as t variable?

this is the script

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bezier : MonoBehaviour
{
[SerializeField]
private LineRenderer lineRenderer;
[SerializeField]
private Transform point0,point1,point2;
private Vector3[] positions = new Vector3[50];
private int numOfPoints = 50;
// Use this for initialization
void Start ()
{
lineRenderer.positionCount = numOfPoints;
}
// Update is called once per frame
void Update ()
{
//DrawLinearCurve();
DrawQuadraticBazierCurve();
}
private void DrawQuadraticBazierCurve()
{
for (int i = 1; i <= numOfPoints; i++)
{
float t = i / (float) numOfPoints;
positions[ i - 1] = CalculateQuadraticBezierPoint(t,point0.position,point1.position,point2.position);
}
lineRenderer.SetPositions(positions);
}
/*private Vector3 CalculateLinearBezierPoint (float t, Vector3 p0, Vector3 p1)
{
return p0 + t * (p1 - p0);
// P = P0 + t ( P1 - P0 )
}*/
private Vector3 CalculateQuadraticBezierPoint (float t, Vector3 p0, Vector3 p1, Vector3 p2)
{
float u = 1 - t;
float tt = t * t;
float uu = u * u;
Vector3 p = uu * p0;
p += 2 * u * t * p1;
p += tt * p2;
return p;
// B(t) = (1-t)2P0 + 2(1-t)tP1 + t2P2
}
}
```