I’m trying to position objects in the world based on screen position. Camera’s ScreenToWorldPoint seemed like it’d do the trick, but it appears to be misbehaving.
It claims to “Convert normalized screen coordinates (0.0 - 1.0) and depth to a world space point.”, but when I run the following code:
// This line should set the cube in the very top-left corner of the screen. Or not?
Vector3 playerPos = camera->ScreenToWorldPoint(Vector3(0, 0, 20));
cubeNode_->SetPosition(playerPos);
When screen height is 800 and width is 600:
When screen height is 800 and width is 200:
Camera is orthographic, of course. Am I doin’ it right? :V
Here’s the code I used, for your perusal.