Sign in to follow this  

[ODE] Invalid operation for locked space

This topic is 2046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[font=Courier, Monospaced]Hi, I'm trying to remove body if I've found collision with plane
(ground), I've tried something like this: [/font]
[CODE] //THIS IS COLLISION CALLBACK
if( numc >0 )
{
for( i = 0; i < numc; i++ )
{
dJointID c=dJointCreateContact( world, contactgroup,
&contact[i] );
dJointAttach(c,b1,b2);
} [/font]
[font="Courier, Monospaced"] if( dGeomGetClass( o1 ) == dPlaneClass )
{
dSimpleSpace( space ).remove( o2 );
return;
}
else if( dGeomGetClass( o2 ) == dPlaneClass )
{
dSimpleSpace( space ).remove( o1 );
return;
}
} [/font]
[/CODE]
[font=Courier, Monospaced]But no, it doesnt work, I'm getting error "invalid operation for
locked space[/font]
And if I try
[CODE]
dBodyDisable( b2 );
I'm getting error: bad arguments
Also I've tried dSpaceRemove but error same as first one
[/CODE] Edited by mrWodoo

Share this post


Link to post
Share on other sites
I think the problem is that ODE expects that you will not change the simulation while it's being processed (while you're in a callback), but the simulation should first be finished before modifying the scene. Therefore one solution might be to queue up object deletions from the callback to an external list, and after the physics simulation step finishes, run through the accumulated list to perform the necessary mutating operations that had piled up during the callback.

Share this post


Link to post
Share on other sites

This topic is 2046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this