Quantcast
Channel: AR/VR (XR) Discussion
Viewing all articles
Browse latest Browse all 12131

[Unity 5.6.1] Determine "Center of Screen" for Raycasting

$
0
0
In all previous versions of Unity, "Center of Screen" can be determined by calling either this for non-vr mode:
Code (CSharp):
  1. new Vector2(0.5f * Screen.width, 0.5f * Screen.height);
Or using EyeTextureWidth/Height when VR Mode is enabled:
Code (CSharp):
  1. new Vector2(0.5f * (float)VRSettings.eyeTextureWidth, 0.5f * (float)VRSettings.eyeTextureHeight);
Now, in Unity 5.6.1, neither one of these will return the correct "center of screen" position as needed for raycasting with...

[Unity 5.6.1] Determine "Center of Screen" for Raycasting

Viewing all articles
Browse latest Browse all 12131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>