Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: hesoul on January 03, 2014, 07:38:28 AM
-
The distance is calculated:
float dist = (cam.rangeDistance > 0f) ? cam.rangeDistance : currentCamera.farClipPlane - currentCamera.nearClipPlane;
when camera is OrthoGraphic there was no problem,but in 3D camare,whether this should be changed?
float dist = 0;
if (cam.rangeDistance > 0f) dist = cam.rangeDistance;
else
{
dist = currentCamera.farClipPlane - currentCamera.nearClipPlane;
if (!currentCamera.isOrthoGraphic)
dist /= Mathf.Cos(Vector3.Angle(currentCamera.transform.forward, ray.direction) * 0.01745f);
}
-
This means you may hit invisible objects. If you want extended range, set the raycast range on the UICamera.
-
but 4 corners may not be hit,as shown in the figure,the red area can not be hit
-
Yup, I know. But in your case objects behind the visible plane will be hit, which is just as wrong. There is no perfect fix here.