/** 直线与圆相交。圆半径和直线的相交点 */ public static Vector3 IntersectionPoint(Vector3 point, Vector3 hit, float radius, Vector3 lineFrom, Vector3 lineTo) { float c = radius; float a = HMath.distance(point, lineFrom, lineTo); float b = Mathf.Sqrt(c * c - a * a); return(hit + (lineTo - lineFrom).normalized * b); }