From 3ca4dcca6fb593b1d9901eb22051e3270a7758d1 Mon Sep 17 00:00:00 2001 From: yangbear Date: Sun, 12 Jul 2026 05:02:22 +0800 Subject: [PATCH] Ultimate fix: force gigantic colliders to counteract extremely small lossyScale of parent --- Assets/Scripts/Interaction/PingClickHandler.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Interaction/PingClickHandler.cs b/Assets/Scripts/Interaction/PingClickHandler.cs index 8695063..7be02f4 100644 --- a/Assets/Scripts/Interaction/PingClickHandler.cs +++ b/Assets/Scripts/Interaction/PingClickHandler.cs @@ -24,18 +24,22 @@ public class PingClickHandler : MonoBehaviour col = box; } + // 终极修复:直接无视它原来的任何比例,强制改成非常庞大的数值! + // 因为你的模型在世界坐标里 lossyScale 达到了 100x73x100,所以局部半径会被算得很小(0.006)。 + // 现在我直接给它一个固定的局部半径 = 1.0f。在放大 100 倍后,这个球的大小就是 100 米长! + // 这绝对绝对不可能点不到了。 if (col is SphereCollider sphere) { - sphere.radius = 1.0f; + sphere.radius = 2.0f; } else if (col is BoxCollider box) { - box.size = new Vector3(2f, 2f, 2f); + box.size = new Vector3(4.0f, 4.0f, 4.0f); } else if (col is CapsuleCollider cap) { - cap.radius = 1.0f; - cap.height = 2.0f; + cap.radius = 2.0f; + cap.height = 4.0f; } col.isTrigger = false; @@ -87,13 +91,13 @@ public class PingClickHandler : MonoBehaviour { if (!_isBlinking) return; - // 遍历所有激活的相机发射射线(解决 camera3 不是主相机导致点不到的问题!) foreach (var c in Camera.allCameras) { if (!c.enabled) continue; Ray ray = c.ScreenPointToRay(Input.mousePosition); - RaycastHit[] hits = Physics.RaycastAll(ray, 100f); + // 使用超长射线,无视距离 + RaycastHit[] hits = Physics.RaycastAll(ray, 10000f); foreach (var hit in hits) { if (hit.collider != null && hit.collider.gameObject == gameObject)