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

Function dGeomSetBody

3rd_party/Src/ode/ode/src/collision_kernel.cpp:308–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306
307
308void dGeomSetBody (dxGeom *g, dxBody *b)
309{
310 dAASSERT (g);
311 dUASSERT (g->gflags & GEOM_PLACEABLE,"geom must be placeable");
312 CHECK_NOT_LOCKED (g->parent_space);
313
314 if (b) {
315 if (!g->body) dFree (g->pos,sizeof(dxPosR));
316 g->pos = b->pos;
317 g->R = b->R;
318 dGeomMoved (g);
319 if (g->body != b) {
320 g->bodyRemove();
321 g->bodyAdd (b);
322 }
323 }
324 else {
325 if (g->body) {
326 dxPosR *pr = (dxPosR*) dAlloc (sizeof(dxPosR));
327 g->pos = pr->pos;
328 g->R = pr->R;
329 memcpy (g->pos,g->body->pos,sizeof(dVector3));
330 memcpy (g->R,g->body->R,sizeof(dMatrix3));
331 g->bodyRemove();
332 }
333 // dGeomMoved() should not be called if the body is being set to 0, as the
334 // new position of the geom is set to the old position of the body, so the
335 // effective position of the geom remains unchanged.
336 }
337}
338
339
340dBodyID dGeomGetBody (dxGeom *g)

Callers 6

dBodyDestroyFunction · 0.85
setBodyMethod · 0.85
CreateMethod · 0.85
CreateMethod · 0.85
set_bodyMethod · 0.85
CreateMethod · 0.85

Calls 5

dFreeFunction · 0.85
dGeomMovedFunction · 0.85
dAllocFunction · 0.85
bodyRemoveMethod · 0.80
bodyAddMethod · 0.80

Tested by

no test coverage detected