/** * Step the world. * * This uses a "big matrix" method that takes time on the order of m^3 * and memory on the order of m^2, where m is the total number of constraint * rows. For large systems this will use a lot of memory and can be very slow, * but this is currently the most accurate method. * @param w w * * @param stepsize The number of seconds that the simulation has to advance. */ //ODE_API public static void dWorldStep (DWorld w, double stepsize) { w.step(stepsize); }
/** * Step the world. * * This uses a "big matrix" method that takes time on the order of m^3 * and memory on the order of m^2, where m is the total number of constraint * rows. For large systems this will use a lot of memory and can be very slow, * but this is currently the most accurate method. * @param w w * * @param stepsize The number of seconds that the simulation has to advance. */ //ODE_API public static void dWorldStep (DWorld w, double stepsize) { w.step(stepsize); }
@Override public void step (boolean pause) { int i; if (!pause) { //static double angle = 0; angle += 0.05; body[NUM-1].addForce(0,0,1.5*(Math.sin(angle)+1.0)); space.collide(0,myNearCallback); world.step(0.05); /* remove all contact joints */ contactgroup.empty(); } dsSetColor (1,1,0); dsSetTexture (DS_TEXTURE_NUMBER.DS_WOOD); for (i=0; i<NUM; i++) dsDrawSphere (body[i].getPosition(), body[i].getRotation(),RADIUS); }
@Override public void step (boolean pause) { if (!pause) { // static double angle = 0; angle += 0.05; body[NUM-1].addForce (0,0,1.5*(Math.sin(angle)+1.0)); space.collide (0,nearCallback); world.step (0.05); // remove all contact joints contactgroup.empty(); } DVector3 sides = new DVector3(SIDE,SIDE,SIDE); dsSetColor (1,1,0); dsSetTexture (DS_TEXTURE_NUMBER.DS_WOOD); for (int i=0; i<NUM; i++) dsDrawBox (body[i].getPosition(),body[i].getRotation(),sides); }
private void simLoop (boolean pause) { int i; if (!pause) { // apply forces to all bodies for (i=0; i<N1; i++) { for (int j=0; j<N2; j++) { body[i][j].addForce (FORCE*(i+1),0,0); } } OdeHelper.spaceCollide (space,0,nearCallback); world.step (0.05); // remove all contact joints contactgroup.empty(); } dsSetColor (1,0,1); DVector3 sides = new DVector3(LENGTH,LENGTH,HEIGHT); for (i=0; i<N1; i++) { for (int j=0; j<N2; j++) { dsDrawBox (box[i][j].getPosition(), box[i][j].getRotation(), sides); } } }
@Override public void step (boolean pause) { if (!pause) { // static double angle = 0; angle += 0.05; body[NUM-1].addForce (0,0,1.5*(sin(angle)+1.0)); space.collide (0,nearCallback); world.step (0.05); // remove all contact joints contactgroup.empty(); } DVector3 sides = new DVector3(SIDE,SIDE,SIDE); dsSetColor (1,1,0); dsSetTexture (DS_TEXTURE_NUMBER.DS_WOOD); for (int i=0; i<NUM; i++) dsDrawBox (body[i].getPosition(),body[i].getRotation(),sides); }
@Override public void step (boolean pause) { if (!pause) { space.collide (null, nearCallback); world.step (0.017); // 60 fps // remove all contact joints contactgroup.empty(); } // Render ramps and spheres dsSetTexture (DS_TEXTURE_NUMBER.DS_WOOD); dsSetColor (1,0.5,0); for (DBox g: rampGeom) { dsDrawBox (g.getPosition(), g.getRotation(), g.getLengths()); } dsSetColor(0,0,1); for (DSphere g: sphereGeom) { dsDrawSphere (g.getPosition(), g.getRotation(), sphereRadius); } }
@Override public void step(boolean pause) { if (!pause) { expStep(expGyroBody); world.step(dt); } dsSetTexture (DS_TEXTURE_NUMBER.DS_WOOD); dsSetColor(1,0,0); dsDrawBox(noGyroBody.getPosition(), noGyroBody.getRotation(), sides); dsSetColor(1,1,0); dsDrawBox(expGyroBody.getPosition(), expGyroBody.getRotation(), sides); dsSetColor(0,1,0); dsDrawBox(impGyroBody.getPosition(), impGyroBody.getRotation(), sides); }
anchor_body.addTorque (torque); test_body.addTorque (torque); world.step (0.03);
dyn_world.step (TIME_STEP/n); coll_contacts.empty ();
@Override public void step (boolean pause) { if (!pause) { // add random forces and torques to all bodies int i; final double scale1 = 5; final double scale2 = 5; for (i=0; i<NUM; i++) { body[i].addForce ( scale1*(dRandReal()*2-1), scale1*(dRandReal()*2-1), scale1*(dRandReal()*2-1)); body[i].addTorque ( scale2*(dRandReal()*2-1), scale2*(dRandReal()*2-1), scale2*(dRandReal()*2-1)); } world.step (0.05); createTest(); } // float sides[3] = {SIDE,SIDE,SIDE}; dsSetColor (1,1,0); for (int i=0; i<NUM; i++) dsDrawSphere (body[i].getPosition(), body[i].getRotation(), RADIUS); }
private void simLoop (boolean pause) { dsSetColor (0,0,2); space.collide(0,nearCallback); if (!pause) { //world.quickStep(0.02); world.step(0.02); } // remove all contact joints contactgroup.empty(); dsSetTexture (DS_TEXTURE_NUMBER.DS_WOOD); dsSetColor (1,0.5f,0); dsDrawCylinder(top1.getPosition(), top1.getRotation(), toplength, topradius); dsDrawCapsule(top1.getPosition(), top1.getRotation(), pinlength, pinradius); dsSetColor (0.5f,1,0); dsDrawCylinder(top2.getPosition(), top2.getRotation(), toplength, topradius); dsDrawCapsule(top2.getPosition(), top2.getRotation(), pinlength, pinradius); }
world.step (0.05); a += 0.01;
if (!pause) world.step(0.02);
if (!pause) world.step (0.05);
world.step(0.05);
world.step (STEPSIZE);
world.step (0.05);
world.step (simstep);
world.step (0.05); contactgroup.empty ();