checkIntersection function
Implementation
Intersection? checkIntersection(
Object3D object,
Material material,
Raycaster raycaster,
Ray ray,
Vector3 pA,
Vector3 pB,
Vector3 pC,
Vector3 point) {
Vector3? intersect;
if (material.side == BackSide) {
intersect = ray.intersectTriangle(pC, pB, pA, true, point);
} else {
intersect =
ray.intersectTriangle(pA, pB, pC, material.side != DoubleSide, point);
}
if (intersect == null) return null;
_intersectionPointWorld.copy(point);
_intersectionPointWorld.applyMatrix4(object.matrixWorld);
var distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld);
if (distance < raycaster.near || distance > raycaster.far) return null;
return Intersection({
"distance": distance,
"point": _intersectionPointWorld.clone(),
"object": object
});
}