/** * Set the orientation of a body. * * <p>REMARKS: * 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 q q */ //ODE_API public static void dBodySetQuaternion (DBody b, final DQuaternion q){ b.setQuaternion(q); }
/** * Set the orientation of a body. * * <p>REMARKS: * 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 q q */ //ODE_API public static void dBodySetQuaternion (DBody b, final DQuaternion q){ b.setQuaternion(q); }
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=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 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 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; }
body[0].setMass (m); body[0].setPosition (0.5*SIDE,0.5*SIDE,1); body[0].setQuaternion (q); body[1].setQuaternion (q);
q3 /= quat_len; quat.set(q0, 0, 0, q3); dyn_bodies[b].setQuaternion (quat); dyn_bodies[b].setAngularVel (0, 0, rot.get2());
DQuaternion qq = new DQuaternion(); OdeMath.dQMultiply1(qq, q, body.getQuaternion()); body.setQuaternion(qq); DMatrix3 R = new DMatrix3(); OdeMath.dRfromQ(R, q);
DQuaternion qq = new DQuaternion(); OdeMath.dQMultiply1(qq, q, body.getQuaternion()); body.setQuaternion(qq); DMatrix3 R = new DMatrix3(); OdeMath.dRfromQ(R, q);
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(); }
bone.body.setAngularVel(0, 0, 0); bone.body.setPosition(bone.position); bone.body.setQuaternion(bone.quaternion); } else { bone.position.set(bone.body.getPosition());
bone.body.setAngularVel(0, 0, 0); bone.body.setPosition(bone.position); bone.body.setQuaternion(bone.quaternion); } else { bone.position.set(bone.body.getPosition());
cylbody.setQuaternion (q); m.setCylinder (1.0,3,CYLRADIUS,CYLLENGTH); cylbody.setMass (m);
for (i=0; i<4; i++) qrot.set(i, dRandReal()-0.5); dNormalize4 (qrot); anchor_body.setQuaternion (qrot); test_body.setQuaternion (qrot); DMatrix3 R = new DMatrix3(); dRfromQ (R, qrot);
DQuaternion q = new DQuaternion(); dQFromAxisAndAngle (q,1,0,0,M_PI*0.5); body[bodyI+i].setQuaternion (q); m.setSphere (1,RADIUS); m.adjust (WMASS);
DQuaternion q = new DQuaternion(); for (j=0; j<4; j++) q.set(j, dRandReal()*2-1); body[i].setQuaternion (q);
DQuaternion q = new DQuaternion(); OdeMath.dQFromAxisAndAngle (q,1,0,0,Math.PI*0.5); body[i].setQuaternion(q); m.setSphere(1,RADIUS); m.adjust(WMASS);