Thread: [cgkit-user] re: ode collisions
Brought to you by:
mbaas
From: Ricardo K. <ric...@gm...> - 2006-05-08 02:23:17
|
So, I think I found the answer to my previous post. I can now controll collisions through the collidecategory and collidebits settings. But I have a new question.... :-) How do I write an interactive controller for my bodies (basically, how can I controll my joints throught the mouse/keyboard)? |
From: Chris B. <chr...@gm...> - 2006-05-08 08:19:20
|
On 08/05/06, Ricardo Kirkner <ric...@gm...> wrote: > So, I think I found the answer to my previous post. I can now controll > collisions through the collidecategory and collidebits settings. > > But I have a new question.... :-) > > How do I write an interactive controller for my bodies (basically, how > can I controll my joints throught the mouse/keyboard)? You can either use (angular or linear) motors, or apply a force directly to a body. Read sections 7.3.8, 7.5.1, and 7.6 in the ODE manual. |
From: Matthias B. <ba...@ir...> - 2006-05-08 19:06:17
|
Ricardo Kirkner wrote: > How do I write an interactive controller for my bodies (basically, how > can I controll my joints throught the mouse/keyboard)? You can register callback functions with the event manager as follows: def onLeftDown(evt): """Callback function.""" print "Left down event:",evt eventmanager.connect(LEFT_DOWN, onLeftDown) See http://cgkit.sourceforge.net/doc2/module-cgkit.events.html for a full list of events you can connect to and for a list of event objects you might receive as input (the arguments depend on the type of event). See http://cgkit.sourceforge.net/doc2/module-cgkit.eventmanager.html for a description of the event manager. As you mentioned the ODEDynamics component, this one can also emit events in the case of collisions (you have to set collision_events=True in the constructor). You can register with the ODE_COLLISION event which will send ODECollisionEvent objects (http://cgkit.sourceforge.net/doc2/odecollisionevent.html). - Matthias - |