In the game I'm making, the character moves over a 2D plane in the 3D world (so y axis is never used for the character). I'd like to be able to control the character by making it follow the mouse pointer around but I'm having serious trouble getting this to work.
I'm guessing I have to find a way to combine the world and screen coordinates to a logical whole. Does anyone know how I can accomplish this?
Here's the gist of what I tried so far:
another option was:
Which obviously isn't right...
Much thanks in advance!
asked Jan 05 '10 at 02:54 PM
See the LookAtMouse script proposed by capnbishop on the wiki :
This makes the object smoothly rotate toward the mouse cursor. Then, you can translate the object forward. See the last instruction in the following code :
This should be a valid base for what you intend to do.
answered Jan 05 '10 at 04:10 PM