/** * Set the body associated with a placeable geom. * * Setting a body on a geom automatically combines the position vector and * rotation matrix of the body and geom, so that setting the position or * orientation of one will set the value for both objects. Setting a body * ID of zero gives the geom its own position and rotation, independent * from any body. If the geom was previously connected to a body then its * new independent position/rotation is set to the current position/rotation * of the body. * * Calling these functions on a non-placeable geom results in a runtime * error in the debug build of ODE. * * @param geom the geom to connect * @param body the body to attach to the geom */ //ODE_API public static void dGeomSetBody (DGeom geom, DBody body) { geom.setBody(body); }
/** * Set the body associated with a placeable geom. * * Setting a body on a geom automatically combines the position vector and * rotation matrix of the body and geom, so that setting the position or * orientation of one will set the value for both objects. Setting a body * ID of zero gives the geom its own position and rotation, independent * from any body. If the geom was previously connected to a body then its * new independent position/rotation is set to the current position/rotation * of the body. * * Calling these functions on a non-placeable geom results in a runtime * error in the debug build of ODE. * * @param geom the geom to connect * @param body the body to attach to the geom */ //ODE_API public static void dGeomSetBody (DGeom geom, DBody body) { geom.setBody(body); }
Card() { body = OdeHelper.createBody(world); geom = OdeHelper.createBox(space, sides.get0(), sides.get1(), sides.get2()); geom.setBody(body); geom.setData(this); DMass mass = OdeHelper.createMass(); mass.setBox(1, sides.get0(), sides.get1(), sides.get2()); body.setMass(mass); }
m.adjust (Mass1); geom[BODY2] = OdeHelper.createBox (space, BODY2_SIDES[0], BODY2_SIDES[1], BODY2_SIDES[2]); geom[BODY2].setBody (body[BODY2]); geom[BODY2].setOffsetRotation(R); geom[BODY2].setCategoryBits (catBits[BODY2]); m.adjust(Mass1); geom[BODY1] = OdeHelper.createCapsule (space, RADIUS, BODY1_LENGTH); geom[BODY1].setBody (body[BODY1]); geom[BODY1].setOffsetRotation (R); geom[BODY1].setCategoryBits (catBits[BODY1]); geom[RECT].setBody (body[BODY1]); geom[RECT].setOffsetPosition ( (BODY1_LENGTH-RECT_SIDES[0]) /2.0,
OdeMath.dMultiply0_133(v, body.getPosition(), R); body.setPosition(v.get0(), v.get1(), v.get2()); g.setBody(body);
v.add((x - RAGDOLLS / 2) * 2, (y - RAGDOLLS / 2) * 2, 0); body.setPosition(v.get0(), v.get1(), v.get2()); g.setBody(body);
private void demo(String[] args) { int i,j; DMass m = OdeHelper.createMass(); // create world OdeHelper.initODE2(0); world = OdeHelper.createWorld(); space = OdeHelper.createHashSpace (null); contactgroup = OdeHelper.createJointGroup (); world.setGravity (0,0,-GRAVITY); ground = OdeHelper.createPlane (space,0,0,1,0); // bodies for (i=0; i<N1; i++) { for (j=0; j<N2; j++) { body[i][j] = OdeHelper.createBody (world); m.setBox (1,LENGTH,LENGTH,HEIGHT); m.adjust (MASS*(j+1)); body[i][j].setMass (m); body[i][j].setPosition (i*2*LENGTH,j*2*LENGTH,HEIGHT*0.5); box[i][j] = OdeHelper.createBox (space,LENGTH,LENGTH,HEIGHT); box[i][j].setBody (body[i][j]); } } // run simulation dsSimulationLoop (args,352,288,this); contactgroup.destroy(); space.destroy(); world.destroy(); OdeHelper.closeODE(); }
coll_box_id = OdeHelper.createBox (coll_space_id, bodies_sides[b].get0(), bodies_sides[b].get1(), bodies_sides[b].get2()); coll_box_id.setBody (dyn_bodies[b]);
for (k=0; k < GPB; k++) { if (obj[i].geom[k] != null) { obj[i].geom[k].setBody (obj[i].body);
sphbody.setMass (m); sphgeom = OdeHelper.createSphere(null, RADIUS); sphgeom.setBody (sphbody); reset_ball(); space.add (sphgeom);
IcosahedronGeom.Sphere_pointcount, IcosahedronGeom.Sphere_polygons); sphgeom.setBody (sphbody); reset_ball(); space.add (sphgeom);
if ( obj[i].geom[k] != null ) obj[i].geom[k].setBody( obj[i].body );