Good day, I have come across the resolution :
The process consists of 2 main steps :
Step 1
I establish 3 lines by utilizing the 3 points available from the triangle :
var line1 = new THREE.Line3(a,b);
var line2 = new THREE.Line3(a,c);
var line3 = new THREE.Line3(b,c);
Subsequently, I identify the nearest point on each of these 3 lines to the sphere's center :
var closestPoint1 = line1.closestPointToPoint(center, true);
var closestPoint2 = line2.closestPointToPoint(center, true);
var closestPoint3 = line3.closestPointToPoint(center, true);
Following that, I compute the distance from that point to the center :
// code for just 1 line
var distToCenter = closestPoint.distanceTo(center);
if(distToCenter <= radius){
// a collision is present
}
That concludes the examination of the lines surrounding the triangle. If no collision occurs with the sphere, I will then examine the interior of the triangle in Step 2 :
Step 2
I generate a THREE.Triangle using the 3 vertices of the triangle, proceed to create a plane based off that triangle, and ultimately locate the closest point from the plane to the center of the sphere . Detection of collision is confirmed if said point aligns with the triangle:
var triangle = new THREE.Triangle( a,b,c );
var plane = triangle.plane();
var pp, cp;
var dp = Math.abs(plane.distanceToPoint(center));
if(dp <= radius){
pp = plane.projectPoint(center);
cp = triangle.containsPoint(pp);
if(cp === true){
// collision detected
}
}
If no signs of collision are found in either Step 1 or Step 2, it implies there is no contact between the triangle and the sphere.
This approach has proven effective in my recent project.
Please do not hesitate to report any issues you might face.