/** * Set position of a body. * * After setting, the outcome of the simulation is undefined * if the new configuration is inconsistent with the joints/constraints * that are present. * @param b b * @param x x * @param y y * @param z z */ //ODE_API public static void dBodySetPosition (DBody b, double x, double y, double z){ b.setPosition(x, y, z); }
/** * Set position of a body. * * After setting, the outcome of the simulation is undefined * if the new configuration is inconsistent with the joints/constraints * that are present. * @param b b * @param x x * @param y y * @param z z */ //ODE_API public static void dBodySetPosition (DBody b, double x, double y, double z){ b.setPosition(x, y, z); }
private void dropBox() { Box box = new Box(); double px = Math.random() * 2 - 1; double py = Math.random() * 2 - 1; double pz = 2.5; box.body.setPosition(px, py, pz); boxes.add(box); }
private void dropBox() { Box box = new Box(); double px = (rand() / ((float)RAND_MAX)) * 2 - 1; double py = (rand() / ((float)RAND_MAX)) * 2 - 1; double pz = 2.5; box.body.setPosition(px, py, pz); boxes.add(box); }
void resetBall(DBody b, int idx) { b.setPosition( 0.5*track_len*Math.cos(track_incl) // Z - 0.5*track_height*Math.sin(track_incl) - ball_radius, // X balls_sep*idx, // Y track_elevation + ball_radius// Z + 0.5*track_len*Math.sin(track_incl) + 0.5*track_height*Math.cos(track_incl)); // DMatrix3 r = new DMatrix3(1, 0, 0, 0, // 0, 1, 0, 0, // 0, 0, 1, 0); DMatrix3 r = new DMatrix3(1, 0, 0, 0, 1, 0, 0, 0, 1); b.setRotation(r); b.setLinearVel(0, 0, 0); b.setAngularVel(0, 0, 0); }
private void reset() { DMatrix3 R = new DMatrix3(); R.setIdentity(); top1.setRotation(R); top2.setRotation(R); top1.setPosition(0.8f, -2, 2); top2.setPosition(0.8f, 2, 2); top1.setAngularVel(1,0,7); top2.setAngularVel(1,0,7); top1.setLinearVel(0,0.2f,0); top2.setLinearVel(0,0.2f,0); }
private void reset() { DMatrix3 R = new DMatrix3(); R.setIdentity(); top1.setRotation(R); top2.setRotation(R); top1.setPosition(0.8f, -2, 2); top2.setPosition(0.8f, 2, 2); top1.setAngularVel(0,0,5); top2.setAngularVel(0,0,5); top1.setLinearVel(0,0.2f,0); top2.setLinearVel(0,0.2f,0); }
private void reset_state() { float sx=-4, sy=-4, sz=2; DQuaternion q = new DQuaternion(); dQFromAxisAndAngle (q,1,0,0,M_PI*0.5); if (BOX) { boxbody.setPosition (sx, sy+1, sz); boxbody.setLinearVel (0,0,0); boxbody.setAngularVel (0,0,0); boxbody.setQuaternion (q); } if (CYL) { cylbody.setPosition (sx, sy, sz); cylbody.setLinearVel (0,0,0); cylbody.setAngularVel (0,0,0); cylbody.setQuaternion (q); } }
private void reset_ball() { float sx=0.0f, sy=2.973f, sz=7.51f; // //#if defined(_MSC_VER) && defined(dDOUBLE) // //sy -= 0.01; // Cheat, to make it score under win32/double // //#endif sy += 0.033; // Windows 64 //TODO //sy += 0.046; //For 'double' on Linux 64bit. //TODO !!! DQuaternion q = new DQuaternion(); q.setIdentity(); sphbody.setPosition (sx, sy, sz); sphbody.setQuaternion(q); sphbody.setLinearVel (0,0,0); sphbody.setAngularVel (0,0,0); }
private void reset_ball() { float sx=0.0f, sy=3.40f, sz=7.15f; // //#if defined(_MSC_VER) && defined(dDOUBLE) // //sy -= 0.01; // Cheat, to make it score under win32/double // //#endif sy += 0.033; // Windows 64 //TODO //sy += 0.046; //For 'double' on Linux 64bit. //TODO !!! DQuaternion q = new DQuaternion(); q.setIdentity(); sphbody.setPosition (sx, sy, sz); sphbody.setQuaternion(q); sphbody.setLinearVel (0,0,0); sphbody.setAngularVel (0,0,0); }
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; }
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(); }
body[0].setPosition (0.5*SIDE,0.5*SIDE,1); body[0].setQuaternion (q); body[1].setPosition (-0.5*SIDE,-0.5*SIDE,1); body[1].setQuaternion (q);
kbody.setKinematic(); final double kx = 1, ky = 0, kz = .5; kbody.setPosition(kx, ky, kz); kbox = OdeHelper.createBox(space, 3, 3, .5); kbox.setBody(kbody); matraca.setPosition(kx+0, ky+1, kz+1); matraca_geom = OdeHelper.createBox(space, 0.5, 2, 0.75); matraca_geom.setBody(matraca);
body2 = OdeHelper.createBody(world); body1.setPosition(0, 0, 3); body2.setPosition(0, 0, 1);
DVector3 v = new DVector3(); OdeMath.dMultiply0_133(v, body.getPosition(), R); body.setPosition(v.get0(), v.get1(), v.get2()); g.setBody(body);
body2 = OdeHelper.createBody(world); body1.setPosition(0, 0, 3); body2.setPosition(0, 0, 2);
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(); }
body[i].setPosition (k,k,k+0.4); DMass m = OdeHelper.createMass(); m.setBox (1,SIDE,SIDE,SIDE);
ya.eqCross(za, xa); body.setPosition(p1.add(p2).scale(0.5)); body.setRotation(new DMatrix3(xa.get0(), ya.get0(), za.get0(), xa.get1(), ya.get1(), za.get1(), xa.get2(), ya.get2(), za.get2())); totalMass += m.getMass();