trimeshTrimesh method

bool trimeshTrimesh(
  1. Trimesh si,
  2. Trimesh sj,
  3. Vec3 xi,
  4. Vec3 xj,
  5. Quaternion qi,
  6. Quaternion qj,
  7. Body bi,
  8. Body bj, [
  9. Shape? rsi,
  10. Shape? rsj,
  11. bool justTest = false,
])

Implementation

bool trimeshTrimesh(
  Trimesh si,
  Trimesh sj,
  Vec3 xi,
  Vec3 xj,
  Quaternion qi,
  Quaternion qj,
  Body bi,
  Body bj,
  [
    Shape? rsi,
    Shape? rsj,
    bool justTest = false,
  ]
){

  if(xi.distanceTo(xj) > si.boundingSphereRadius + sj.boundingSphereRadius){
    return false;
  }

  // Construct a temp hull for each triangle
  final hullB = ConvexPolyhedron();

  hullB.faces = [[0,1,2]];
  final va = Vec3();
  final vb = Vec3();
  final vc = Vec3();

  final triangleNormal = Vec3();

  hullB.vertices = [va,vb,vc];

  for (int i = 0; i < si.indices.length / 3; i++) {
    si.getTriangleVertices(i, va, vb, vc);
    si.getFaceNormal(i, triangleNormal);

    hullB.faceNormals = [triangleNormal];

    convexTrimesh(hullB, sj, xi, xj, qi, qj, bi, bj);
  }
  return false;
}