diff options
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters')
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/Physics2DRaycaster.cs | 1 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/PhysicsRaycaster.cs | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/Physics2DRaycaster.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/Physics2DRaycaster.cs index 783cf95..6346938 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/Physics2DRaycaster.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/Raycasters/Physics2DRaycaster.cs @@ -13,6 +13,7 @@ namespace UnityEngine.EventSystems protected Physics2DRaycaster() {} + // 发射线 public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList) { if (eventCamera == null) 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); |