private DJoint addHingeJoint(DxRagdollBody body1, DxRagdollBody body2, DVector3 anchor, DVector3 axis, double loStop, double hiStop) { DHingeJoint joint = OdeHelper.createHingeJoint(world); joint.attach(body1.body, body2.body); joint.setAnchor(anchor); joint.setAxis(axis); joint.setParam(PARAM_N.dParamLoStop1, loStop); joint.setParam(PARAM_N.dParamHiStop1, hiStop); joints.add(joint); return joint; }
private static void inspectJoints() { final double forcelimit = 2000.0; int i; for (i=0; i<SEGMCNT-1; i++) { if (hinges[i].getBody(0)!=null) { // This joint has not snapped already... inspect it. double l0 = jfeedbacks[i].f1.length();// dLENGTH(jfeedbacks[i].f1); double l1 = jfeedbacks[i].f2.length();// dLENGTH(jfeedbacks[i].f2); colours[i+0] = 0.95*colours[i+0] + 0.05 * l0/forcelimit; colours[i+1] = 0.95*colours[i+1] + 0.05 * l1/forcelimit; if (l0 > forcelimit || l1 > forcelimit) stress[i]++; else stress[i]=0; if (stress[i]>4) { // Low-pass filter the noisy feedback data. // Only after 4 consecutive timesteps with excessive load, snap. System.err.println("SNAP! (that was the sound of joint " + i + " breaking)"); hinges[i].attach (null, null); } } } }
private DJoint addHingeJoint(DxRagdollBody body1, DxRagdollBody body2, DVector3 anchor, DVector3 axis, double loStop, double hiStop) { DHingeJoint joint = OdeHelper.createHingeJoint(world); joint.attach(body1.body, body2.body); joint.setAnchor(anchor); joint.setAxis(axis); joint.setParam(PARAM_N.dParamLoStop1, loStop); joint.setParam(PARAM_N.dParamHiStop1, hiStop); joints.add(joint); return joint; }
hinge.attach(kbody, matraca); hinge.setAnchor(kx, ky, kz+1); hinge.setAxis(0, 0, 1);
hinge.attach(kbody, matraca); hinge.setAnchor(kx, ky, kz+1); hinge.setAxis(0, 0, 1);
hinge.attach (body[0],body[1]); hinge.setAnchor (0,0,1); hinge.setAxis (1,-1,1.41421356);
1,1,0, 1,1,0, 0.25*M_PI,0.25*M_PI); jointHinge = OdeHelper.createHingeJoint (world,null); jointHinge.attach (body[0],body[1]); jointHinge.setAnchor (0,0,1); jointHinge.setAxis (1,-1,1.41421356); 1,0,0, 1,0,0, 0,0); jointHinge = OdeHelper.createHingeJoint (world,null); jointHinge.attach (body[0],body[1]); jointHinge.setAnchor (0,0,1); jointHinge.setAxis (0,0,1); 1,0,0, 1,0,0, 0,0); jointHinge = OdeHelper.createHingeJoint (world,null); jointHinge.attach (body[0],body[1]); jointHinge.setAnchor (0,0,1); jointHinge.setAxis (0,0,1); 1,0,0, 1,0,0, 0,0); jointHinge = OdeHelper.createHingeJoint (world,null); jointHinge.attach (body[0],body[1]); jointHinge.setAnchor (0,0,1); jointHinge.setAxis (0,1,0);
hinges[i].attach (segbodies[i],segbodies[i+1]); hinges[i].setAnchor (i + 0.5 - SEGMCNT/2.0, 0, 5); hinges[i].setAxis (0,1,0);