Mouse position to world position
by William Hilke · in Torque Game Builder · 09/04/2009 (10:42 pm) · 1 replies
I've been searching the forums but I just can't seem to find an answer to what I'm looking to do.
I have my camera attached to my player sprite, to keep the player centered as often as possible.
The player moves around the map by clicking to a new location, which causes the camera to follow the player.
I'm having trouble converting the mouse position from OnMouseDown() into world coords that can be used in object.setPosition().
I've tried using sceneWindow2D.getWorldPoint(), which isn't converting mouse coords to world coords.
Anyone know how to convert local mouse coords to world coords when the camera is a subset of the whole world, and can move?
I have my camera attached to my player sprite, to keep the player centered as often as possible.
The player moves around the map by clicking to a new location, which causes the camera to follow the player.
I'm having trouble converting the mouse position from OnMouseDown() into world coords that can be used in object.setPosition().
I've tried using sceneWindow2D.getWorldPoint(), which isn't converting mouse coords to world coords.
Anyone know how to convert local mouse coords to world coords when the camera is a subset of the whole world, and can move?
Torque Owner William Hilke