Game Development Community

World position -> pixel position?

by Jason McIntosh · in Torque Game Builder · 03/01/2005 (5:33 pm) · 4 replies

Is there a function to translate a world position to screen coordinates?

#1
03/02/2005 (3:04 am)
@Jason: There currently isn't. Because the world-position isn't necessarily being view and can be view by multiple windows simultaneously, we'd have to be careful how to structure it.

Perhaps "fxSceneWindow2D::getScreenPosition( %worldPosition, %extrapolate? )" would be an apt function which returns the screen coordindate and if "%extrapolate?" is true then it extrapolates where (in pixels) it would be but if that's false then return nothing as it's off screen.

Okay, I'm convinced. On the TODO list. List growing to overflowing. ;)

- Melv.
#2
03/02/2005 (5:10 am)
What, it wasn't overflowing before? :P
#3
03/02/2005 (5:23 am)
It was overflowing before but now it's spilling over and starting to wet my knees! ;)

- Melv.
#4
03/20/2005 (6:34 am)
FYI

Added the following functions...

getWorldPoint() - Converts fxSceneWindow2D GUI position to fxSceneGraph2D World-Position.
getWindowPoint() - Converts fxSceneGraph2D World-Position to fxSceneWindow2D GUI position.
getCanvasPoint() - Converts fxSceneWindow2D GUI position to Canvas GUI position (main window).
getIsWindowPoint() - Checks if fxSceneGraph2D World-Position is currently being displayed in fxSceneWindow2D GUI.

These additional functions allow conversion for Canvas (main window) pixels, fxSceneWindow2D GUI pixels and fxSceneGraph2D World-Position (world-units).

Expect these in the next update.

- Melv.