detectCollision method
Detect collision of the shapes provided
Implementation
@override
void detectCollision(Shape shape1, Shape shape2,ContactManifold manifold){
if(shape1 is Tetra && shape2 is Tetra){
int i, j;
Vector3 vec;
List<Face> fs1 = shape1.faces;
List<Vector3> vs1 = shape1.verts;
Vector3 j1, j2, j3;
int ts = 0; // Triangle vertices `j1`, `j2` and `j3`
// fs is undeclared
List<Face> fs = fs1;
for(i = 0; i < 4; i++){
vec = vs1[i];
for(j = 0; j < 4; j++){
j1 = fs[i].a;
j2 = fs[i].b;
j3 = fs[i].c;
if(
tricheck(pt(vec.x, vec.y), pt(j1.x, j1.y), pt(j2.x, j2.y), pt(j3.x, j3.y)) &&
tricheck(pt(vec.x, vec.z), pt(j1.x, j1.z), pt(j2.x, j2.z), pt(j3.x, j3.z)) &&
tricheck(pt(vec.z, vec.y), pt(j1.z, j1.y), pt(j2.z, j2.y), pt(j3.z, j3.y))
){
ts++;
}
if(ts == 4){
manifold.addPointVec(vec);
}
}
}
}
}