/** * Set the mass of a body. * @param b b * @param mass mass * */ //ODE_API public static void dBodySetMass (DBody b, DMassC mass){ b.setMass(mass); }
/** * Set the mass of a body. * @param b b * @param mass mass * */ //ODE_API public static void dBodySetMass (DBody b, DMassC mass){ b.setMass(mass); }
Box()// : // body(world), // geom(space, 0.2, 0.2, 0.2) { body = OdeHelper.createBody(world); geom = OdeHelper.createBox(space, 0.2, 0.2, 0.2); DMass mass = OdeHelper.createMass(); mass.setBox(10, 0.2, 0.2, 0.2); body.setMass(mass); geom.setData(this); geom.setBody(body); } void draw() //const
Box()// : // body(world), // geom(space, 0.2, 0.2, 0.2) { body = OdeHelper.createBody(world); geom = OdeHelper.createBox(space, 0.2, 0.2, 0.2); DMass mass = OdeHelper.createMass(); mass.setBox(10, 0.2, 0.2, 0.2); body.setMass(mass); geom.setData(this); geom.setBody(body); } void draw() //const
private void adjustMass(DRagdollConfig skeleton) { for (DxRagdollBody bone : bones) { DMass mass = ((DMass)bone.getBody().getMass()); mass.adjust(bone.getBody().getMass().getMass() * skeleton.getMass() / totalMass); bone.getBody().setMass(mass); } }
private void adjustMass(DRagdollConfig skeleton) { for (DxRagdollBody bone : bones) { DMass mass = ((DMass)bone.getBody().getMass()); mass.adjust(bone.getBody().getMass().getMass() * skeleton.getMass() / totalMass); bone.getBody().setMass(mass); } }
private void constructWorldForTest (double gravity, int bodycount, /* body 1 pos */ double pos1x, double pos1y, double pos1z, /* body 2 pos */ double pos2x, double pos2y, double pos2z, /* body 1 rotation axis */ double ax1x, double ax1y, double ax1z, /* body 1 rotation axis */ double ax2x, double ax2y, double ax2z, /* rotation angles */ double a1, double a2) { // create world world = OdeHelper.createWorld(); world.setERP (0.2); world.setCFM (1e-6); world.setGravity (0,0,gravity); DMass m = OdeHelper.createMass(); m.setBox (1,SIDE,SIDE,SIDE); m.adjust (MASS); body[0] = OdeHelper.createBody (world); body[0].setMass (m); body[0].setPosition(pos1x, pos1y, pos1z); DQuaternion q = new DQuaternion(); dQFromAxisAndAngle (q,ax1x,ax1y,ax1z,a1); body[0].setQuaternion (q); if (bodycount==2) { body[1] = OdeHelper.createBody (world); body[1].setMass (m); body[1].setPosition (pos2x, pos2y, pos2z); dQFromAxisAndAngle (q,ax2x,ax2y,ax2z,a2); body[1].setQuaternion (q); } else body[1] = null; }
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); }
private void demo(String[] args) { // create world OdeHelper.initODE2(0); world = OdeHelper.createWorld(); DMass m = OdeHelper.createMass(); m.setBox (1,SIDE,SIDE,SIDE); m.adjust (MASS); body[0] = OdeHelper.createBody (world); body[0].setMass (m); body[0].setPosition (0,0,1); body[1] = OdeHelper.createBody (world); body[1].setMass (m); DQuaternion q = new DQuaternion(); dQFromAxisAndAngle (q,-1,1,0,0.25*M_PI); body[1].setPosition (0.2,0.2,1.2); body[1].setQuaternion (q); slider = OdeHelper.createSliderJoint (world,null); slider.attach (body[0], body[1]); slider.setAxis (1,1,1); // run simulation dsSimulationLoop (args,352,288,this); world.destroy (); OdeHelper.closeODE(); }
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(); }
DMass mass = OdeHelper.createMass(); mass.setBox(1, 0.5, 2, 0.75); matraca.setMass(mass);
m.setBox (1,SIDE,SIDE,SIDE); m.adjust (MASS); body[i].setMass (m); body[i].setData (i);
m.setBox (1,SIDE,SIDE,SIDE); m.adjust (MASS); body[i].setMass (m); body[i].setData (i);
DMass m = OdeHelper.createMass(); m.setCapsule(1, 3, radius, cyllen); body.setMass(m); DCapsule geom = OdeHelper.createCapsule(space, radius, cyllen); geom.setBody(body);
DMass m = OdeHelper.createMass(); m.setCapsule(1, 3, radius, cyllen); body.setMass(m); DCapsule geom = OdeHelper.createCapsule(space, radius, cyllen); geom.setBody(body);