Game Development Community

Mouse position problem

by Nir Ziso · in Torque Game Builder · 08/07/2006 (1:52 am) · 5 replies

I put an object in some place when I move the mouse on that object I made some script that tell me the mouse position of the cursor
The problem is that I get strange result of when the mouse is
For example my y object position is -16 and when I stand on the object at same height the mouse position is -21 instead of 16 why?
The camera is set to 100 75 and I use canvas coordinates

#1
08/07/2006 (6:56 am)
Where are you positioning the mouse? If you've set the object Y value to be -16, then move the mouse to the centre of the object. The mouse value should be around -16 (it may not be exact since the value is a float). If it doesn't, then type this in the console "echo(sceneWindow2d.getMousePosition())" and see what value is returned. If the value there is around -16, then your mouse co-ordinates script is wrong.
#2
08/07/2006 (9:20 am)
When i place an object is it on the left top corner or on the middle of the object?
#3
08/07/2006 (9:49 am)
The middle.
#4
08/07/2006 (10:13 am)
Ok i understand so if i want to get the left top point of the object i use getAreaMin() function
thanks alot
#5
08/07/2006 (10:28 am)
Your welcome :).