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
Comments (3)
-
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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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);