[ODE] math question

Roel van Dijk roelvandijk at home.nl
Wed Jul 16 14:04:02 2003


I don't really understand your question. Do you want to know where a body will 
be the next simulation step? In that case you simply add the body's velocity 
vector to it's position vector. You have to scale the velocity vector by the 
step time ofcourse.

dBodyID body;
...
dVector3 pos = dBodyGetPosition(body);
dVector3 vel = dBodyGetLinearVel(body);
// you have to guess the time step
for (int i=0; i<3; i++) vel[i] *= timeStep;
dVector3 nextPos;
for (int i=0; i<3; i++) nextPos[i] = pos[i] + vel[i];

// a vector form the current position to the next position
dVector3 curToNext;
for (int i=0; i<3; i++) curToNext;i] = nextPos[i] - pos[i];

You could do the same for the rotation of an object.

Roel

On Wednesday 30 July 2003 20:00, Alex Hetu wrote:
> Hi guys,
>
> I'd like to find a way to know exactly how far a body could move from its
> current position during the next simulation step. Assuming that there would
> be no contacts at all, I would need either the next position or a simple
> vector that would describe the translation from the current position to the
> next. Anyone with a solution? :)
>
> thx,
> Alex