From: Chris B. <chr...@gm...> - 2007-04-23 09:00:59
|
On 23/04/07, Simon Hildebrandt <twi...@ob...> wrote: > Firstly, I'd like to second Martijn's sentiment - ODE (and PyODE) are very nice to work with. :) > > Secondly - I have a problem that I hope someone has already solved, and that they can point me in the right direction... > Am I going about this the wrong way? I *do* seem to be fighting ODE for control of the object - is it back-to-front to think I can control an ODE object's exact position, while still having it collide with other objects? The problem is that you're simulating a body with ODE. The body has mass, velocity, momentum etc. which I'm assuming you don't want - you want to click and drag the object instead. So you can either: a) not use an ODE body for your object - use a Geom, do the collision detection, then in your collide handler create an ode.ContactJoint, and instead of attaching it to the body of the draggable Geom attach it to the static environment (ode.environment). That should give ODE a contact on the object you hit, but not on the one you're dragging. b) envisage the mouse location as somewhere you'd like the object to be, rather than actually is. Use something like a proportional derivative or LQR controller to add forces to the dragged object in order to reposition it. This way you're treating the object as a proper body, so there will be some delay before it reaches your desired position. |