/** * Utility function. * @return 1 if the two bodies are connected together by * a joint that does not have type {@code joint_type}, otherwise return 0. * @param body1 A body to check. * @param body2 A body to check. * @param joint_type is a dJointTypeXXX constant. * This is useful for deciding whether to add contact joints between two bodies: * if they are already connected by non-contact joints then it may not be * appropriate to add contacts, however it is okay to add more contact between- * bodies that already have contacts. */ public static boolean dAreConnectedExcluding (DBody body1, DBody body2, Class<? extends DJoint> joint_type) { return OdeHelper.areConnectedExcluding(body1, body2, joint_type); }
/** * Utility function. * @return 1 if the two bodies are connected together by * a joint that does not have type {@code joint_type}, otherwise return 0. * @param body1 A body to check. * @param body2 A body to check. * @param joint_type is a dJointTypeXXX constant. * This is useful for deciding whether to add contact joints between two bodies: * if they are already connected by non-contact joints then it may not be * appropriate to add contacts, however it is okay to add more contact between- * bodies that already have contacts. */ public static boolean dAreConnectedExcluding (DBody body1, DBody body2, Class<? extends DJoint> joint_type) { return OdeHelper.areConnectedExcluding(body1, body2, joint_type); }
/** * Utility function. * @return 1 if the two bodies are connected together by * a joint that does not have type {@code joint_type}, otherwise return 0. * @param body1 A body to check. * @param body2 A body to check. * @param joint_type is a dJointTypeXXX constant. * This is useful for deciding whether to add contact joints between two bodies: * if they are already connected by non-contact joints then it may not be * appropriate to add contacts, however it is okay to add more contact between- * bodies that already have contacts. */ //ODE_API public static boolean dAreConnectedExcluding (DBody body1, DBody body2, Class<? extends DJoint> ... joint_type) { return OdeHelper.areConnectedExcluding(body1, body2, joint_type); } /**
/** * Utility function. * @return 1 if the two bodies are connected together by * a joint that does not have type {@code joint_type}, otherwise return 0. * @param body1 A body to check. * @param body2 A body to check. * @param joint_type is a dJointTypeXXX constant. * This is useful for deciding whether to add contact joints between two bodies: * if they are already connected by non-contact joints then it may not be * appropriate to add contacts, however it is okay to add more contact between- * bodies that already have contacts. */ //ODE_API public static boolean dAreConnectedExcluding (DBody body1, DBody body2, Class<? extends DJoint> ... joint_type) { return OdeHelper.areConnectedExcluding(body1, body2, joint_type); } /**
private void nearCallback (Object data, DGeom o1, DGeom o2) { DBody b1 = o1.getBody(); DBody b2 = o2.getBody(); if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)) return; DContactBuffer contacts = new DContactBuffer(MAX_CONTACTS); // up to MAX_CONTACTS contacts per box-box for (int i=0; i<MAX_CONTACTS; i++) { DContact contact = contacts.get(i); contact.surface.mode = dContactBounce | dContactRolling; contact.surface.mu = 250; contact.surface.rho = 0.2; contact.surface.bounce = 0.2; } int numc = OdeHelper.collide (o1,o2,MAX_CONTACTS,contacts.getGeomBuffer() ); if (numc != 0) { for (int i=0; i<numc; i++) { DContact contact = contacts.get(i); DJoint c = OdeHelper.createContactJoint (world,contactgroup,contact ); c.attach (b1,b2); } } }
private static void nearCallback (Object data, DGeom o1, DGeom o2) { int i,n; DBody b1 = o1.getBody(); DBody b2 = o2.getBody(); if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class) ) return; final int N = 10; 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); contact.surface.mu = 0.1; contact.surface.slip1 = 0.02; contact.surface.slip2 = 0.02; contact.surface.soft_erp = 0.1; contact.surface.soft_cfm = 0.0001; DJoint c = OdeHelper.createContactJoint (world,contactgroup,contact); c.attach (contact.geom.g1.getBody(), contact.geom.g2.getBody() ); } } }
private static void nearCallback (Object data, DGeom o1, DGeom o2) { int i,n; DBody b1 = o1.getBody(); DBody b2 = o2.getBody(); if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)) return; final int N = 10; //dContact[] contact=new dContact[N]; DContactBuffer contacts = new DContactBuffer(N); n = OdeHelper.collide (o1,o2,N,contacts.getGeomBuffer());//,sizeof(dContact)); if (n > 0) { for (i=0; i<n; i++) { DContact contact = contacts.get(i); contact.surface.mode = OdeConstants.dContactSlip1 | OdeConstants.dContactSlip2 | OdeConstants.dContactSoftERP | OdeConstants.dContactSoftCFM | OdeConstants.dContactApprox1; contact.surface.mu = 0.1; contact.surface.slip1 = 0.02; contact.surface.slip2 = 0.02; contact.surface.soft_erp = 0.1; contact.surface.soft_cfm = 0.0001; DJoint c = OdeHelper.createContactJoint (world,contactgroup,contact); c.attach (contact.geom.g1.getBody(),contact.geom.g2.getBody()); } } }
private void nearCallback(Object data, DGeom g1, DGeom g2) { if (g1 == ground) { queueRemoval(g2); return; } if (g2 == ground) { queueRemoval(g1); return; } DBody b1 = g1.getBody(); DBody b2 = g2.getBody(); if (b1!=null && b2!=null && areConnectedExcluding(b1, b2, DContactJoint.class)) return; final int MAX_CONTACTS = 10; //DContact contact[MAX_CONTACTS]; DContactBuffer contacts = new DContactBuffer(MAX_CONTACTS); int n = OdeHelper.collide(g1, g2, MAX_CONTACTS, contacts.getGeomBuffer());//, sizeof(dContact)); for (int i=0; i<n; ++i) { contacts.get(i).surface.mode = 0; contacts.get(i).surface.mu = 1; DJoint j = OdeHelper.createContactJoint (world, joints, contacts.get(i)); j.attach(b1, b2); } }
private static 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 && areConnectedExcluding (b1,b2,DContactJoint.class)) return; DContactBuffer contacts = new DContactBuffer(MAX_CONTACTS); // up to MAX_CONTACTS contacts per box-box for (int i=0; i<MAX_CONTACTS; i++) { DContact contact = contacts.get(i); contact.surface.mode = OdeConstants.dContactBounce | OdeConstants.dContactSoftCFM; contact.surface.mu = OdeConstants.dInfinity; contact.surface.mu2 = 0; contact.surface.bounce = 0.1; contact.surface.bounce_vel = 0.1; contact.surface.soft_cfm = 0.01; } int numc = OdeHelper.collide (o1,o2,MAX_CONTACTS,contacts.getGeomBuffer()); if (numc!=0) { DMatrix3 RI = new DMatrix3(); RI.setIdentity (); DVector3 ss = new DVector3(0.02,0.02,0.02); for (int i=0; i<numc; i++) { DJoint c = OdeHelper.createContactJoint (world,contactgroup,contacts.get(i)); c.attach (b1,b2); if (show_contacts) dsDrawBox (contacts.get(i).geom.pos,RI,ss); } } }
private void nearCallback (Object data, DGeom o1, DGeom o2) { int i; // if (o1->body && o2->body) return; // 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 && areConnectedExcluding (b1,b2,DContactJoint.class)) return; DContactBuffer contacts = new DContactBuffer(MAX_CONTACTS); // up to MAX_CONTACTS contacts per box-box for (i=0; i<MAX_CONTACTS; i++) { DContact contact = contacts.get(i); contact.surface.mode = dContactBounce | dContactSoftCFM; contact.surface.mu = dInfinity; contact.surface.mu2 = 0; contact.surface.bounce = 0.1; contact.surface.bounce_vel = 0.1; contact.surface.soft_cfm = 0.01; } int numc = OdeHelper.collide (o1,o2,MAX_CONTACTS,contacts.getGeomBuffer()); if (numc != 0) { DMatrix3 RI = new DMatrix3(); RI.setIdentity(); final DVector3 ss = new DVector3(0.02,0.02,0.02); for (i=0; i<numc; i++) { DJoint c = OdeHelper.createContactJoint (world,contactgroup,contacts.get(i)); c.attach (b1,b2); if (show_contacts) dsDrawBox (contacts.get(i).geom.pos,RI,ss); } } }
if ( b1!=null && b2!=null && areConnectedExcluding( b1,b2,DContactJoint.class ) ) return;
if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)) { return;
if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)) { return;
if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)) { return;
if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)) { return;
if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)) { return;
if (b1!=null && b2!=null && OdeHelper.areConnectedExcluding (b1,b2,DContactJoint.class)) { return;
if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)) return;