View Full Version : Interpolating between positions

07-01-2005, 10:08 PM
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.


07-02-2005, 12:24 AM
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 (http://\'http://schafik.free.fr/vm.games/index.php\')