Ok, here is exactly what i am trying to do.
-
When i move my mouse over the surface, i collect the CVector2 points into std::vector
-
Those points shall create a Bezier Path for my object to follow it
At this point i have positions stored and i need to
- Calculate the X,Z on this bezier path later on, so that my object will follow this path.
Now here is what i have:
- Store all the points as the std::vector
- And when engine ticks the object i :
// Return position on Bezier at current fTime
CVector3 CBezierPath::Calculate(const float& fTime) { CVector3
vPosition; … return vPosition; }
Yes, how do i calculate the position in fTime on a Bezier Path made from N number of points?
Ok found solution,
Knowing that i have x number of waypoints, i generate Bezier curves where number of curves is equal to:
iCurves = iWaypointsCount / 3
Now after i calculate T for current curve i just skip to another curve and restart calculating to from 0 to 1.