PDA

View Full Version : removing objects that have collided


hotspur1
05-25-2010, 10:16 AM
I am running a robotics simulation and I want to quit a particular trial after having grabbed an object. I am using the physics engine to detect collisions but when I try to remove the grasped object, I get a physics engine exception. I have a 60 Hz timer that drives the simulation rendering and a keyboard event which signals the end of the trial ('q' key). Within the keyboard callback, I tried to disable the collision notification for the two objects but it doesn't seem to work properly. I have a callback routine that should run when a collision event ends, but it doesn't occur. I am guessing that because it is dealing with a keyboard event callback, it cannot be interrupted by the collision ending event (when the notification is disabled).

I presume the exception then arises because the physics engine thinks that two objects are still in a collided state but one of them is no longer part of the scene graph. Is there a way to clear/reset the state of the physics engine so I am basically starting with a clean slate for each new trial?

Can I simply disable the physics engine, remove and add objects as needed, then start the physics engine again without starting in the previous state?

Thanks

hotspur1
05-26-2010, 10:02 AM
Nevermind - I am using the <viztask>.waitEvent to wait for the COLLIDE_END_EVENT to occur before removing the target objects. I guess the problem was that the event did not occur before the call to remove the object, hence the exception in the physics engine.

You can close this thread