Hi - Does anyone know of a way to figure out the world space position of the screen edges, ie top and left, which does not invoke ScreenToWorldPoint()?
Ah, this is where it gets weird. The game starts with a blank screen menu with text. Up until the menu is removed (menu task finished), ScreenToWorldPoint() returns an incorrect x position of -2, when it should be -1.28 (the y position is correct in all cases). Once the startmenu is removed then the correct position is returned. I cannot explain this; there seems to be nothing in startmenu that could cause the error.
I am developing in C# (sorry!), and this behaviour can be reproduced in the ‘SamplyGame’ project, which is a Urhosharp example game.
Ok, it seems the ScreenToWorld() works ok. The problem is the camera, specifically the projection matrix is altered from the incorrect (square screen) values (M11=2.41, M22=2.41) to the correct value M11=3.87, M22=2.41.
Why the matrix is altered just by closing the ‘menu’ task, is a mystery to me. It is also a mystery as to why the correct values are not there from the get go. Maybe not a mystery to someone else?
A workaround for this was to wait until the camera projection is correct, then build the scene using ScreenToWorld(). This works, so I guess there is no point continuing this topic.