/** * Get the gravity vector for a given world. * @param w w * @param gravity gravity */ //ODE_API public static void dWorldGetGravity (DWorld w, DVector3 gravity) { w.getGravity(gravity); }
space = OdeHelper.createHashSpace(null); contactgroup = OdeHelper.createJointGroup(); world.setGravity(0,0,-GRAVITY); world.setCFM (1e-5); world.setAutoDisableFlag (true); world.setAutoDisableAverageSamplesCount( 10 ); world.setLinearDamping(0.00001); world.setAngularDamping(0.005); world.setMaxAngularSpeed(200); world.setContactMaxCorrectingVel (0.1); world.setContactSurfaceLayer (0.001); OdeHelper.createPlane (space,0,0,1,0); world.destroy (); OdeHelper.closeODE();
/** * Set the global ERP value, that controls how much error * correction is performed in each time step. * @param w the identifier of the world. * @param erp Typical values are in the range 0.1--0.8. The default is 0.2. */ //ODE_API public static void dWorldSetERP (DWorld w, double erp) { w.setERP(erp); }
private void demo (String[] args) { OdeHelper.initODE2(0); world = OdeHelper.createWorld(); space = OdeHelper.createSimpleSpace(); contactgroup = OdeHelper.createJointGroup(); world.setGravity (0,0,-9.81); world.setContactMaxCorrectingVel(2.5); world.setMaxAngularSpeed(1); world.setAngularDamping(0.6 * STEP_SIZE); world.setAngularDampingThreshold(0); world.setLinearDampingThreshold(0); world.setLinearDamping(0.6 * STEP_SIZE); for (int i = 0; i < obj.length; i++) obj[i] = new MyObject(); OdeHelper.createPlane( space, 0, 0, 1, 0 ); dsSimulationLoop (args,352,288,this); contactgroup.destroy (); space.destroy (); world.destroy (); OdeHelper.closeODE(); }
space = OdeHelper.createHashSpace (null); contactgroup = OdeHelper.createJointGroup (); world.setGravity (0,0,-0.05); world.setCFM (1e-5); world.setAutoDisableFlag (true); world.setContactMaxCorrectingVel (0.1); world.setContactSurfaceLayer (0.001); for (int i = 0; i < obj.length; i++) { obj[i] = new MyObject(); world.setAutoDisableAverageSamplesCount( 1 ); world.destroy();
world.setGravity (0,0,-0.5); world.setCFM (1e-5); world.setLinearDamping(0.00001); world.setAngularDamping(0.005); world.setMaxAngularSpeed(200); world.setContactSurfaceLayer (0.001); ground = OdeHelper.createPlane (space,0,0,1,0); world.destroy (); OdeHelper.closeODE();
world.setGravity(0,0,-0.5f); world.setCFM(1e-5f); world.setLinearDamping(0.00001f); world.setAngularDamping(0.0001f); world.DESTRUCTOR();//delete world; OdeHelper.closeODE();
private void demo(String[] args) { // create world OdeHelper.initODE2( 0 ); world = OdeHelper.createWorld(); space = OdeHelper.createSimpleSpace( null ); contactgroup = OdeHelper.createJointGroup(); world.setGravity( 0,0,-0.5 ); world.setCFM( 1e-5 ); OdeHelper.createPlane( space,0,0,1,0 ); for (int i = 0; i < NUM; i++) obj[i] = new MyObject(); // run simulation dsSimulationLoop( args,352,288,this ); contactgroup.destroy(); space.destroy(); world.destroy(); OdeHelper.closeODE(); }
@Override public void step(boolean pause) { if (!pause) { final double step = 0.005; final int nsteps = 4; for (int i=0; i<nsteps; ++i) { double f = Math.sin(t*1.2)*0.8; body1.addForceAtRelPos( f, 0, 0, 0.1, 0.1, -0.5); // at the lower end double g = Math.sin(t*0.7)*0.8; body2.addForceAtRelPos( 0.2 * g, g, 0, 0.1, 0, -0.5); // at the lower end t += step; world.quickStep(step); } } // now we draw everything for (DGeom g : space.getGeoms()) { drawGeom(g); } }
/** * 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); }
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; }
world.setGravity (0,0,-1.5); world.setCFM (1e-5); world.setERP (0.8); world.setQuickStepNumIterations (ITERS);
private void demo(String[] args) { OdeHelper.initODE2(0); world = OdeHelper.createWorld(); world.setGravity(0, 0, -0.5); world.setQuickStepNumIterations(50); // <-- increase for more stability space = OdeHelper.createSimpleSpace(null); //space = OdeHelper.createSapSpace(AXES.XYZ); //space = OdeHelper.createBHVSpace(0); contactgroup = OdeHelper.createJointGroup(); DGeom ground = OdeHelper.createPlane(space, 0, 0, 1, 0); place_cards(); // run simulation dsSimulationLoop (args, 640, 480, this); levels = 0; place_cards(); contactgroup.destroy(); world.destroy(); ground.destroy(); space.destroy(); OdeHelper.closeODE(); }
world.setGravity(0,0,-9.8); world.setDamping(1e-4, 1e-5);
world.setERP (0.8); fixedJ.attach ( null, body[BODY2]); fixedJ.setFixed (); world.setGravity (0,0,-0.8); world.setGravity (0,0,0); world.destroy (); OdeHelper.closeODE();
world.getGravity(g); if ( g.get2() < -0.1 ) world.setGravity(0, 0, 0); else world.setGravity(0, 0, -0.5);
/** * Destroy a world and everything in it. * * This includes all bodies, and all joints that are not part of a joint * group. Joints that are part of a joint group will be deactivated, and * can be destroyed by calling, for example, dJointGroupEmpty(). * @param world the identifier for the world the be destroyed. */ //ODE_API public static void dWorldDestroy (DWorld world) { world.destroy(); }
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(); }
world.setGravity(0,0,-9.8); world.setERP(0.2);
contactgroup = OdeHelper.createJointGroup(); world = OdeHelper.createWorld(); world.setGravity (0,0,-0.5); world.setCFM (1e-5); space = OdeHelper.createSimpleSpace(null); OdeHelper.createPlane(space,0,0,1,0);