here are the steps to add and remove......and the remove part is causing an assert,,
Code: Select all
if(shapeType==STATIC)
{
isStatic=true;
cpBodyDestroy(theBody); //memory if allocated for normal body get rid of it
theBody=cpBodyNewStatic();
cpBodySetPos(theBody,theRealPos);
}
else
{
isStatic=false;
cpBodySetMass(theBody,this->theMass);
cpBodySetPos(theBody,theRealPos);
}
//shape definition...assuming for now its a box
theShape=cpBoxShapeNew(theBody,5,5);
cpSpaceAddBody(theWorld,theBody);
cpSpaceAddShape(theWorld,theShape);
//docs mention that u neednt use addstaticshape if u aint using a rogue body.....so i am not using it
///heres the remove part...not part of a collision process...the updatestep is disabled and nothing else is
//messing with my physics objects
cpSpaceRemoveBody(theWorld,this->theBody);
theShape->data=NULL;
cpSpaceRemoveShape(theWorld,this->theShape);
cpBodyFree(this->theBody);
cpShapeFree(this->theShape);
it does crash if i dont remove that step for static bodies, but even the removeshape step crashes
for static bodies regardless of removebody is called or not....where the heck am i goin wrong.....
thanks for reading....

pls help me if u can