@ Pure public static boolean intersectsSphereCapsule ( double sphereCenterx , double sphereCentery , double sphereCenterz , double sphereRadius , double capsuleAx , double capsuleAy , double capsuleAz , double capsuleBx , double capsuleBy , double capsuleBz , double capsuleRadius ) { // Compute (squared) distance between sphere center and capsule line segment double dist2 = AbstractSegment3F . distanceSquaredSegmentPoint ( capsuleAx , capsuleAy , capsuleAz , capsuleBx , capsuleBy , capsuleBz , sphereCenterx , sphereCentery , sphereCenterz ) ; // If (squared) distance smaller than (squared) sum of radii, they collide double radius = sphereRadius + capsuleRadius ; return dist2 < radius * radius ; }
Replies if the specified sphere intersects the specified capsule .