private void nearCallback(Object data, DGeom o1, DGeom o2) { int i; // only collide things with the ground boolean g1 = (o1 == ground); boolean g2 = (o2 == ground); if (!(g1 ^ g2)) return; DBody b1 = o1.getBody(); DBody b2 = o2.getBody(); DContactBuffer contacts = new DContactBuffer(3); // up to 3 contacts per box for (i = 0; i < 3; i++) { contacts.get(i).surface.mode = OdeConstants.dContactSoftCFM | OdeConstants.dContactApprox1; contacts.get(i).surface.mu = MU; contacts.get(i).surface.soft_cfm = 0.01; } int numc = OdeHelper.collide(o1, o2, 3, contacts.getGeomBuffer()); if (numc != 0) { // [0].geom,sizeof(dContact))) { for (i = 0; i < numc; i++) { DJoint c = OdeHelper.createContactJoint(world, contactgroup, contacts.get(i)); c.attach(b1, b2); } } }