checkIntersection function

Intersection? checkIntersection(
  1. Object3D object,
  2. Material material,
  3. Raycaster raycaster,
  4. Ray ray,
  5. Vector3 pA,
  6. Vector3 pB,
  7. Vector3 pC,
  8. Vector3 point,
)

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});
}