Search Issue Tracker
By Design
Votes
0
Found in
2017.3.1f1
Issue ID
1009570
Regression
No
Calculation errors in Camera API's World/Screen space transformation functions
How to reproduce:
1. Download attached project and open "Default" Scene
2. Click anywhere in the Scene Window and compare the debug outputs with the code contained in TrackEditorMouse.HandleEvent().
3. Fit the SceneView camera (perspective mode) to view the entire cube contained in the scene.
4. Click the outmost pixel on any of the corners of the cube.
5. Move the Scene Window camera around to inspect the two rays calculated from the mouse click (without clicking the left mouse button again)
6. The green ray (my method) will be more accurate than the red ray (Camera.ScreenPointToRay()), but BOTH are off target.
Actual result: The functions Camera.WorldToScreenPoint(), Camera.ScreenToWorldPoint(), Camera.ScreenPointToRay(), Camera.pixelHeight and other Camera-related functions yield slightly incorrect results.
Reproduced with: 2017.1.3p2, 2017.2.2f1, 2017.3.1p3, 2018.1.0b10, 2018.2.0a3
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
- Project Browser shows the Asset folder empty when Select Dependencies is clicked without any asset selected
- Export as JSON and CSV options missing from the Quick Search save feature
- Crash on IMGUI::GUIWindow::OnGUI when rendering scene view window in play mode in a specific project
- "FileNotFoundException" & "IOException" thrown when adding "User" Index after deleting "Assets" Index in Search Index Manager window
- Camera Background Solid Color does not Render
Resolution Note:
This is actually expected behavior. The calculation for screenCenter is correct, the calculation for expectedScreenCenter is not.
You should really be using "c.pixelRect.center", and not (c.pixelWidth*0.5f, c.pixelHeight*0.5f)