|
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!
(comments are locked)
|
|
See the LookAtMouse script proposed by capnbishop on the wiki : http://www.unifycommunity.com/wiki/index.php?title=LookAtMouse 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. Thanks a bunch, that's exaclty what I needed! The only problem now is, my main camera is a child of the character (I did that so the character is always at the center of the screen) so all I need now is a way to keep the rotation of my camera fixed on its starting rotation, otherwise everything just goes in circles... Do you know of a good way to do this? I tried this: But it's no good. Thanks again and sorry for the bother...
Jan 05 '10 at 05:19 PM
era
Scratch last comment, i found a solution that's so mindnumbingly easy i just looked over it. Thanks again, your answer helped me out great!
Jan 06 '10 at 02:49 PM
era
(comments are locked)
|
