# [ODE] Invalid operation for locked space

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

## 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]
 //THIS IS COLLISION CALLBACK if( numc >0 ) { for( i = 0; i < numc; i++ ) { dJointID c=dJointCreateContact( world, contactgroup, &contact ); 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] 
[font=Courier, Monospaced]But no, it doesnt work, I'm getting error "invalid operation for
locked space[/font]
And if I try
 dBodyDisable( b2 ); I'm getting error: bad arguments Also I've tried dSpaceRemove but error same as first one  Edited by mrWodoo

##### 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.

1. 1
Rutin
19
2. 2
3. 3
JoeJ
16
4. 4
5. 5

• 27
• 20
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631700
• Total Posts
3001790
×