Search Issue Tracker
By Design
Votes
19
Found in
2017.3.0a1
2018.2.0a1
2018.2.11f1
2018.3.0a1
2019.1.0a1
Issue ID
1100140
Regression
No
[XR][OpenVR] ScreenPointToRay() is offset when used in VR
Steps to reproduce:
1. Download and open the attached project
2. Enter playmode in VR
3. Set aspect ratio to "Remote" if not done automatically
4. Position HMD to look at any of the sphere objects
5. Focus Game view and move the mouse on any of them
Expected result: a raycast is registered and the sphere dissapears
Actual result: the raycast does not hit exactly where the objects are, but in the area around them
Reproduced on 2017.4.15f1, 2018.2.16f1, 2018.3.0b10, 2019.1.0a9
Notes:
- Only reproducible on OpenVR SDK, not on Oculus SDK
-
dhami-nitin
Jun 17, 2022 12:36
still facing same issue but with Nreal
-
spockthegray-mk2
Jan 25, 2021 23:38
Hi, is this an issue still in Unity 2020?
-
mattabaker
Jul 07, 2020 19:38
This solution does not work in free aspect ratio.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Editor default Stylesheet/Matching Selector buttons in Debugger don't do anything
- Graphics.DrawMeshNow stops rendering Render Texture after a few frames when viewed in the Player
- New selector in Matching Selectors displays as on line -1 in debugger
- The first frames are skipped when playing a video
- Text auto-scrolling can not work when naming assets/objects until backspace key is pressed
Resolution Note:
The root of the problem is that what you see in the gameview window if cropped : it's only 70% of the whole image (only for SteamVR).
With this knowledge, you can easily adjust your code to fix the issue :
var screenPos = Vector3.zero;
screenPos.x = 0.15f * camera.pixelWidth + 0.7f * Input.mousePosition.x;
screenPos.y = 0.15f * camera.pixelHeight + 0.7f * Input.mousePosition.y;
Ray ray = camera.ScreenPointToRay(screenPos, camera.stereoActiveEye);