# [ODE] body positions

Lewis Foster doof205 at gmail.com
Mon Jan 22 09:52:18 MST 2007

```Thanks for the replies, I appreciate it. It really was as basic as i thought
it might be, oh well.

Does anyone know of any more complicated simulation examples that I can take
a look at? It would be really useful to see how people with alot of
experience do things.

Lewis

On 1/22/07, Tim Sorrells <tsorrells at breakawayltd.com> wrote:
>
>  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
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://mooshika.org/mailman/listinfo/ode
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mooshika.org/pipermail/ode/attachments/20070122/6cc1e314/attachment-0001.htm
```