Quantcast
Channel: Answers by "Hamdullahshah"
Viewing all articles
Browse latest Browse all 10

Answer by Hamdullahshah

$
0
0
Use a bezier curve of two point private Vector3 CalculateBezierPoint (float t, Vector3 startPosition, Vector3 endPosition, Vector3 controlPoint) { float u = 1 - t; float uu = u * u; Vector3 point = uu * startPosition; point += 2 * u * t * controlPoint; point += t * t * endPosition; return point; } Call it from update something like this.transform.position = CalculateBezierPoint(currentDuration/duration,startPos,endPos,cp); currentDuration += Time.deltaTime; where "duration" is total time. More info on wikipedia for bezier curves: http://en.wikipedia.org/wiki/File:Bezier_2_big.gif

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images