[ODE] body positions

Tim Sorrells tsorrells at breakawayltd.com
Mon Jan 22 09:33:39 MST 2007


The dReal* is simply an array of dReal.  It's identical to a definition
of "dReal Position[3]" or "dVector3 Position".  So all you'd need to do
to copy the position is:

 

const dReal* BodyPosition = dBodyGetPosition(BodyID);

dBodySetPosition(BodyID2, BodyPosition[0], BodyPosition[1],
BodyPosition[2]);

 

(NOTE: I didn't compile that, so there may be a typo in there, but you
can figure it out)

 

However, this would put the missiles you mentioned exactly in the same
location as the plane, so you'll need to figure out a positional offset
to apply and deal with the rotation of the plane as well.

 

________________________________

From: ode-bounces at ode.org [mailto:ode-bounces at ode.org] On Behalf Of
Lewis Foster
Sent: Monday, January 22, 2007 5:02 AM
To: ode at ode.org
Subject: [ODE] body positions

 

I'm playing around with ropes and ODE in general and im struggling with
the basics at the minute.

Basically, body.getPosition() returns a const dReal* to the internal
data structure right? and body.setPosition() takes 3 parameters for x,y
and z. So how do i get at the coordinates from the returned dReal* that
getPosition() gives me? I'm wanting to get the coords of one body so
that i can apply them to another body. 

If anyone knows where there is some example code of a similar situation
i'd really appreciated it. I couldn't find anything in the test demo's
or in the documentation.

Surely its common occurance to want to get a the location of one body
and apply similar coords to another body? Dynamically adding missiles to
a plane would require something like this surely, unless all missles are
on the plane from the start. 

Thanks for any pointers,

Lewis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mooshika.org/pipermail/ode/attachments/20070122/e2d049de/attachment.htm


More information about the ODE mailing list