diff options
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/PhysicsRaycaster.cs')
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/PhysicsRaycaster.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/PhysicsRaycaster.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/PhysicsRaycaster.cs index 2b4bea3..c7d431c 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/PhysicsRaycaster.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/PhysicsRaycaster.cs @@ -3,6 +3,8 @@ using UnityEngine.UI; namespace UnityEngine.EventSystems { + //c 投射3D物体的相机挂这个脚本 + /// <summary> /// Simple event system using physics raycasts. /// </summary> @@ -66,7 +68,7 @@ namespace UnityEngine.EventSystems { ray = eventCamera.ScreenPointToRay(eventData.position); // compensate far plane distance - see MouseEvents.cs - float projectionDirection = ray.direction.z; + float projectionDirection = ray.direction.z; // ray.direction是归一化了的 distanceToClipPlane = Mathf.Approximately(0.0f, projectionDirection) ? Mathf.Infinity : Mathf.Abs((eventCamera.farClipPlane - eventCamera.nearClipPlane) / projectionDirection); @@ -78,6 +80,7 @@ namespace UnityEngine.EventSystems if (eventCamera == null || !eventCamera.pixelRect.Contains(eventData.position)) return; + // 根据触摸数据拿到射线 Ray ray; float distanceToClipPlane; ComputeRayAndDistance(eventData, out ray, out distanceToClipPlane); |