Interpolating between positions

Basically, I am getting data(x,y,x-> coords of the object) every 100ms.

So rendering this object happens at 10 FPS.

I want to interpolate between the ‘current position’ and ‘next position’ so that object takes 100 ms to go from point-0 to point-1, while maintaining the Frame Rate at 30.

Thanks.

assuming you have a vector3 class with x y z members

you can do a linear interpolation like this

void Vector3::Combine( const Vector3 &U, const Vector3 &V, float balance ) {

		const float oneMinusBalance = 1.0f - balance;

		x =	U.x * oneMinusBalance + V.x * balance;
		y =	U.y * oneMinusBalance + V.y * balance;
		z =	U.z * oneMinusBalance + V.z * balance;
}

this is also other sort of interpolation like spherical interpolition , cubic etc … try to use your favorite search engine about it

vm.games