[ODE] Drag bodys trough mouse motion
Philipp Roßberger
rossbe_p at informatik.haw-hamburg.de
Thu Nov 16 10:59:04 MST 2006
Hi,
i want to drag ODE objects by connecting them through joints to a body
that follows the mouse motion. My program should work like this: first I
select a object by clicking on it. The object should now follow the mouse
motion as long as the mouse button is pressed. While moving around the
object should move and rotate like it's attached to the mouse cursor.
Picking the object e.g. on a corner should have another effect on the
object's motion than picking the object at the middle, just like in
reality when you e.g. pickup something.
I found the following program sequence in the JV-ODE forum to realize my
idea:
1. I create an ODE body and position it at the location of my mouse
pointer (I disabled gravity for the object). This is my "mouse body".
2. When I click an object a joint is created between the mouse body and
the selected ODE object.
3. While moving the mouse, the mouse body gets positioned to the
coordinates of the mouse pointer. I use dGeomSetPosition() for this.
3. When I release the mouse button the joint is destroyed.
I implemented this sequence, but somehow I don't get the expected
behaviour. I am not sure if it's a problem of my values or if it's a
general problem for ODE that I manipulate the position of the mouse body
by hand.
Has anybody tried to implement something similar? Any hints?
Thanks in advance
Philipp
More information about the ODE
mailing list