[ODE] math question

Alex Hetu alexhetu at videotron.ca
Wed Jul 16 14:27:01 2003


I'm not sure the velocity would be accurate because i'm not sure it takes
the current forces, gravity and mass into consideration. In a big simulation
step, an object is not expected to move in a linear way. Do you know if the
velocity on a body is changed immediately after you add some force to an
object. Is it computed before, or after a timestep?

Alex

-----Original Message-----
From: ode-admin@q12.org [mailto:ode-admin@q12.org]On Behalf Of Roel van
Dijk
Sent: Wednesday, July 16, 2003 7:04 PM
To: ode@q12.org
Subject: Re: [ODE] math question


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

_______________________________________________
ODE mailing list
ODE@q12.org
http://q12.org/mailman/listinfo/ode