[ODE] Create joint with given relative pos/rot of two bodies

Ignacio García Fernández ignacio.garcia at uv.es
Tue Nov 28 08:31:23 MST 2006


I'm developing a model in which, during the simulation, I need to fix
two bodies using a given relative position/orientation, which is not the
actual relative position/orientation.

Think of two bodies that I want to join by an slider joint, aligned with
their X axis, and passing through their centre.

I need to keep them free until they are close enough. And I'd like to
avoid using dBodySetPosition before calling dJointAttach, to avoid

I have managed a way to do it, which I outline below, but I'd like to
know if there is a better way.

What I currently do is:

1) If body A and body B are ready to be attached, then:
	2) Store body A's position and orientation in
	   auxiliary variables.
	3) Change A's position and orientation to fit the relative
	   position and orientation I desire, and then join them.
	4) Restore A to its previous position and orientation
5) let the simulation go on.

Any comments and suggestions will be welcome.


Ignacio García

May the source be with you                                     
Ignacio García Fernández                  Instituto de Robótica
ignacio.garcia_at_uv.es                 Universidad de Valencia
http://robotica.uv.es/~ignacio/                Tlf. 96 354 3671

More information about the ODE mailing list