MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / dBodyDestroy

Function dBodyDestroy

3rd_party/Src/ode/ode/src/ode.cpp:284–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284void dBodyDestroy (dxBody *b)
285{
286 dAASSERT (b);
287
288 // all geoms that link to this body must be notified that the body is about
289 // to disappear. note that the call to dGeomSetBody(geom,0) will result in
290 // dGeomGetBodyNext() returning 0 for the body, so we must get the next body
291 // before setting the body to 0.
292 dxGeom *next_geom = 0;
293 for (dxGeom *geom = b->geom; geom; geom = next_geom) {
294 next_geom = dGeomGetBodyNext (geom);
295 dGeomSetBody (geom,0);
296 }
297
298 // detach all neighbouring joints, then delete this body.
299 dxJointNode *n = b->firstjoint;
300 while (n) {
301 // sneaky trick to speed up removal of joint references (black magic)
302 n->joint->node[(n == n->joint->node)].body = 0;
303
304 dxJointNode *next = n->next;
305 n->next = 0;
306 removeJointReferencesFromAttachedBodies (n->joint);
307 n = next;
308 }
309 if (b->world) dWorldRemoveBody (b->world,b);
310 delete b;
311}
312
313
314void dBodySetData (dBodyID b, void *data)

Callers 7

dTestDataStructuresFunction · 0.85
~dBodyMethod · 0.85
createMethod · 0.85
ReleaseMethod · 0.85
destroyMethod · 0.85
DestroyMethod · 0.85
DestroyMethod · 0.85

Calls 4

dGeomGetBodyNextFunction · 0.85
dGeomSetBodyFunction · 0.85
dWorldRemoveBodyFunction · 0.85

Tested by

no test coverage detected