History: Find Spline index
Source of version: 3 (current)
Copy to clipboard
__Note:__ This only works if the spline nodes are evenly spaced (if not this could help: ((Equal Length Spline))).
{CODE(wrap="1", colors="c++")}
int getIndex(Ogre::SimpleSpline* theSpline, float splinePosition)
{
return floor(splinePosition * (float)theSpline->getNumPoints());
}
{CODE}