[ODE] multiple geoms for single body?

David Whittaker david at csworkbench.com
Tue Apr 15 09:50:01 2003


> Hi,
>
> On the topic of multiple geom for a single body, is it possible to get
> the geom object from the transform object? I`ve tried using the
> dGeomTransformGetGeom function I get back Geom that never seems to move
> (we have code that shows geom as 'wireframe' and on every other peice of
> geom its fine). Its very hard to position the geom in our physics editor
> without being able to see it, or watch it move using the wireframe view.

The transformed geom stores it's positional and rotational *offset* from
the geomTransform.  So you have to get position and orientation of the
geomTransform, rotate the position of the transformed geom by the
orientation of the geomTransform and add this position to the
geomTransforms position to get the transformed geom's actual position. 
You also need to rotate the transformed geom's orientation by the
geomTransform's orientation to get the transformed geom's actual
orientation.  But you're in luck, the code to do all that is in the
simLoop function of test_boxstack.  I don't have the code right in front
of me right now, but it should be in the section that starts with
something like "if (cls == dGeomTransformClass)".

> Does anyone know how to get the transform geom correctly? I`m using
> Delphi so I`m not sure a paste or link to code would be much use to you
> C/C++ guys ;)
>
> Thanks,
>
> James.
>
> P.S. Sorry Dave for the original direct e-mail, was meant to be a reply
> all :)

Ah, but if you hit reply all, I get two copies anyway... but that's
another rant for another day.

>> -----Original Message-----
>> From: David Whittaker [mailto:david@csworkbench.com]
>> Sent: Sunday, April 13, 2003 05:37
>> To: ode@q12.org
>> Subject: Re: [ODE] multiple geoms for single body?
>>
>>
>> Well, you can call dGeomSetBody with several different geoms,
>> but the same
>> body.  If you don't want those geoms centered at the same place as the
>> body, you can use a geom transform object, and set the geom's
>> position and
>> rotation to the offset from the body's center, then set the
>> geom transform
>> to the body.  Some good source code that demonstrates this idea is in
>> test_boxstack.  Search for "else if (cmd == 'x')" to find the
>> area where
>> several geoms are set to the same body.
>>
>> Let us know if that's not enough to get you started.
>> David Whittaker
>>
>> > I'm still trying to learn ODE's collision detection system,
>> it's pretty
>> > hard  :-/
>> >
>> > I want to know whether it is possible to assign multiple
>> geoms to the
>> > same  body. If it is possible, can someone give me example code?
>> >
>> > I looked at the documents, and it said that if I try to
>> move a geom, it
>> > will  also move the body. So I don't see how I can move
>> several geoms
>> > relative to  1 body.
>> >
>> >
>> >
>> >
>> >
>> > _________________________________________________________________
>> The new MSN 8: smart spam protection and 2 months FREE*
>> > http://join.msn.com/?page=features/junkmail
>> >
>> > _______________________________________________
>> > ODE mailing list
>> > ODE@q12.org
>> > http://q12.org/mailman/listinfo/ode
>>
>>
>>
>> _______________________________________________
>> ODE mailing list
>> ODE@q12.org
>> http://q12.org/mailman/listinfo/ode
>>
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode