void updateTargetDistance() { DVector3 p1 = new DVector3(), p2 = new DVector3(); if (node[0].body != null) //dBodyGetRelPointPos(node[0].body, anchor1[0], anchor1[1], anchor1[2], p1); node[0].body.getRelPointPos(anchor1, p1); else //dCopyVector3(p1, anchor1); p1.set(anchor1); if (node[1].body != null) //dBodyGetRelPointPos(node[1].body, anchor2[0], anchor2[1], anchor2[2], p2); node[1].body.getRelPointPos(anchor2, p2); else //dCopyVector3(p2, anchor2); p2.set(anchor2); targetDistance = p1.distance(p2);//dCalcPointsDistance3(p1, p2); }
void updateTargetDistance() { DVector3 p1 = new DVector3(), p2 = new DVector3(); if (node[0].body != null) //dBodyGetRelPointPos(node[0].body, anchor1[0], anchor1[1], anchor1[2], p1); node[0].body.getRelPointPos(anchor1, p1); else //dCopyVector3(p1, anchor1); p1.set(anchor1); if (node[1].body != null) //dBodyGetRelPointPos(node[1].body, anchor2[0], anchor2[1], anchor2[2], p2); node[1].body.getRelPointPos(anchor2, p2); else //dCopyVector3(p2, anchor2); p2.set(anchor2); targetDistance = p1.distance(p2);//dCalcPointsDistance3(p1, p2); }
private DxRagdollBody addBody(DVector3 p1, DVector3 p2, double radius) { p1 = new DVector3(p1); p2 = new DVector3(p2); double cyllen = p1.distance(p2) - radius; DBody body = OdeHelper.createBody(world); DMass m = OdeHelper.createMass();
private DxRagdollBody addBody(DVector3 p1, DVector3 p2, double radius) { p1 = new DVector3(p1); p2 = new DVector3(p2); double cyllen = p1.distance(p2) - radius; DBody body = OdeHelper.createBody(world); DMass m = OdeHelper.createMass();
info.setC(0, k * (targetDistance - globalA1.distance(globalA2)));
mindist = 1e-15; if (pl.distance(pb)<mindist) {
info.setC(0, k * (targetDistance - globalA1.distance(globalA2)));
mindist = 1e-15; if (pl.distance(pb)<mindist) {
n.normalize(); ray.set (q,n); ray.setLength (q.distance(q2)); if (OdeHelper.collide (ray,sphere,1,contacts) != 0) if (testFAILED()) return false; if (OdeHelper.collide (ray,sphere,1,contacts) != 1) if (testFAILED()) return false; q2.eqSum( p, q, r ); if (contacts.get(0).pos.distance(q2) > tol) if (testFAILED()) return false; if (OdeHelper.collide (ray,sphere,1,contacts)!=0) { DContactGeom contact = contacts.get(0); k = contacts.get(0).pos.distance(sphere.getPosition()); if (dFabs(k - r) > tol) if (testFAILED()) return false;
if (alignment > 0.99 // about 8 degrees of difference && contact.geom.pos.distance(contacts.get(j).geom.pos) < epsilon) {
k = (dRandReal()-0.5)*l; for (j=0; j<3; j++) b.set(j, p.get(j) + r*0.99*b.get(j) + k*0.99*R.get(j,2) ); ray.setLength (a.distance(b)); b.sub( a ); b.normalize ();
dNormalize3 (n); dGeomRaySet (ray,q.get0(),q.get1(),q.get2(),n.get0(),n.get1(),n.get2()); dGeomRaySetLength (ray,q.distance(q2)); if (dCollide (ray,sphere,1,contacts) != 0) if (testFAILED()) return false; if (dCollide (ray,sphere,1,contacts) != 1) if (testFAILED()) return false; for (j=0; j<3; j++) q2.set(j, r * q.get(j) + p.get(j) ); if (contacts.get(0).pos.distance(q2) > tol) if (testFAILED()) return false; if (dCollide (ray,sphere,1,contacts)!=0) { DContactGeom contact = contacts.get(0); k = contacts.get(0).pos.distance(dGeomGetPosition(sphere)); if (dFabs(k - r) > tol) if (testFAILED()) return false;
k = (dRandReal()-0.5)*l; for (j=0; j<3; j++) b.set(j, p.get(j) + r*0.99*b.get(j) + k*0.99*R.get(j, 2) );//v[j*4+2] ); dGeomRaySetLength (ray,a.distance(b)); for (j=0; j<3; j++) b.add(j,-a.get(j) ); dNormalize3 (b);
n.normalize(); ray.set (q2,n); ray.setLength (q2.distance(q4)); if (OdeHelper.collide (ray,box,1,contacts) != 0) if (testFAILED()) return false;
dNormalize3 (n); dGeomRaySet (ray,q2.get0(),q2.get1(),q2.get2(),n.get0(),n.get1(),n.get2()); dGeomRaySetLength (ray,q2.distance(q4)); if (dCollide (ray,box,1,contacts) != 0) if (testFAILED()) return false;