[ODE] Problems reseting an object.

Nick Featherston nichaladas at gmail.com
Mon Aug 28 20:52:35 MST 2006

I am trying to reset a sphere Geom after it goes off a table (I am making a
snooker game).

All I want to do is return my white ball to its original position after it
goes into a pocket or falls off the table.

Previously when I was playing around with ODE, I could simply destroy and
re-create spheres when I wanted to reset them,
however for some reason this no longer works with my code.


dGeomSetPosition(poolBalls[WHITE_BALL].geom, 0.0, 0.0, -6.0);

gives me the error
ODE INTERNAL ERROR 2: invalid operation for geom in locked space in

My white ball is stored in an array of structs that contain the dGeomID and
dBodyID.  It was initialised like this:

   //Initialise the balls.
   for(i = 0; i < BALL_COUNT; i++)
      //Create a body for the ball.
      poolBalls[i].body = dBodyCreate(objectWorld);

      //Set balls position.
      dBodySetPosition(poolBalls[i].body, poolPosition[i][0], 0.0,

      //Set the mass of the object.
      dMassSetSphereTotal(&poolBalls[i].mass, 1.0, BALL_RADIUS);
      dBodySetMass(poolBalls[i].body, &poolBalls[i].mass);

      //Create the geom sphere.
      poolBalls[i].geom = dCreateSphere(objectSpace, BALL_RADIUS);

      //Set the geom to this body.
      dGeomSetBody(poolBalls[i].geom, poolBalls[i].body);

When I tried just deleting the body or geom, I get:
ODE INTERNAL ERROR 2: invalid operation for geom in locked space in
ODE INTERNAL ERROR 2: invalid operation for locked space in dSpaceRemove()

This code was an extension of my previous code where I got deleting and
recreating working.
However now it doesn't work at all.

This is my initialisation of my world and space.  I also have other calls to
set the gravity etc on the world.
   //Create a new world.
   objectWorld = dWorldCreate();

   //Create a space.
   objectSpace = dSimpleSpaceCreate(0);

Any help would be appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060829/abfb0578/attachment.htm

More information about the ODE mailing list