How is it possible to get a cursors X and Y Location relative to the scene planes rather than using co-ordinates based upon pixels of screen height and width?
I have the start of a very basic game, picture with a few physical aids shown below.
I want to find out how far away the cursor is on the X and Y axis from an object in the scene.
The Z axis is irrelevant due to the nature and orientation of the game, so z = 0
. (Note that in Unity, the Y axis is vertical)
Basically, the distance of the cursor from the cube on the X Axis upon clicking will define the power
of an action.
Because of this. I want to get the cursor X position relative to the 0 point of the scene ( or the object ), not relative to the bottom left corner of the screen.
I could then use Vector3.Magnitude()
to get the distance.
How is this possible?