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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
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)