/** * Utility function. * @param b1 b1 * @param b2 b2 * @return 1 if the two bodies are connected together by * a joint, otherwise return 0. */ //ODE_API public static boolean dAreConnected (DBody b1, DBody b2) { return OdeHelper.areConnected(b1, b2); }
/** * Utility function. * @param b1 b1 * @param b2 b2 * @return 1 if the two bodies are connected together by * a joint, otherwise return 0. */ //ODE_API public static boolean dAreConnected (DBody b1, DBody b2) { return OdeHelper.areConnected(b1, b2); }
private void nearCallback (Object data, DGeom o1, DGeom o2) { // exit without doing anything if the two bodies are connected by a joint DBody b1 = o1.getBody(); DBody b2 = o2.getBody(); if (b1!=null && b2!=null && OdeHelper.areConnected (b1,b2)) return; // @@@ it's still more convenient to use the C interface here. DContactBuffer contacts = new DContactBuffer(1); DContact contact = contacts.get(0); contact.surface.mode = 0; contact.surface.mu = Double.POSITIVE_INFINITY;//TODO dInfinity; if (OdeHelper.collide (o1,o2,1,contacts.getGeomBuffer())!=0) {//&contact.geom,sizeof(dContactGeom))) { DJoint c = OdeHelper.createContactJoint (world,contactgroup,contact); c.attach(b1, b2); } }
private static void cb_near_collision (Object data, DGeom o1, DGeom o2) { DBody b1 = o1.getBody(); DBody b2 = o2.getBody(); //dContact contact = new dContact(); DContactBuffer contacts = new DContactBuffer(1); // exit without doing anything if the two bodies are static if (b1 == null && b2 == null) { return; } // exit without doing anything if the two bodies are connected by a joint if (b1!=null && b2!=null && OdeHelper.areConnected(b1, b2)) { /* MTRAP; */ return; } contacts.get(0).surface.mode = 0; contacts.get(0).surface.mu = 0; // frictionless if (OdeHelper.collide (o1, o2, 1, contacts.getGeomBuffer())!=0);//, sizeof (dContactGeom))) { DJoint c = OdeHelper.createContactJoint (dyn_world, coll_contacts, contacts.get(0)); c.attach (b1, b2); } }
private void nearCallback (Object data, DGeom o1, DGeom o2) { int i,n; DBody b1 = o1.getBody(); DBody b2 = o2.getBody(); if (b1!=null && b2!=null && OdeHelper.areConnected(b1, b2)) return; final int N = 4; DContactBuffer contacts = new DContactBuffer(N); n = OdeHelper.collide (o1,o2,N,contacts.getGeomBuffer());//[0].geom,sizeof(dContact)); if (n > 0) { for (i=0; i<n; i++) { DContact contact = contacts.get(i); contact.surface.mode = dContactSlip1 | dContactSlip2 | dContactSoftERP | dContactSoftCFM | dContactApprox1; if ( o1 instanceof DSphere || o2 instanceof DSphere ) contact.surface.mu = 20; else contact.surface.mu = 0.5; contact.surface.slip1 = 0.0; contact.surface.slip2 = 0.0; contact.surface.soft_erp = 0.8; contact.surface.soft_cfm = 0.01; DJoint c = OdeHelper.createContactJoint(world,contactgroup,contact); c.attach (o1.getBody(), o2.getBody()); } } }