- Home /
Player looking/aiming at mouse
I am currently working on a project that uses a 2D player "sprite" (using planes for the body, arms, head, etc.) and is in a 3D play space using an orthographic camera and wasd to move. I want the arms to aim at the mouse, as well as the head to look at the mouse by rotating. I have tried several times and still cannot get it to work properly. Most attempts result in the head rotating out of place and not following the mouse cursor at all.
Here is an example of how I want it to rotate, but in a 3D play space rather than 2D:
Unity (4.3) - 2D Platformer w/ Mouse Aiming
I am still learning how to code and have been trying to get it to work for several days now but to no avail. Any help is greatly appreciated.
Answer by cdrandin · Jul 24, 2014 at 12:57 AM
Well first start with this problem piece-wise.
Get your figure to move.
Then have his head look at the mouse, using LookAt
Then continue to build the logic off of that
$$anonymous$$y problem was occurring when I rotated my object and I got a script working so that it rotates on the right axis. Thanks for the help.
Your answer
Follow this Question
Related Questions
Shoot where to camera direction ? 3 Answers
Limit local rotation around x, y, and z axes? 0 Answers
Slow Character Movement 1 Answer
Gun aim off center 0 Answers
Error when changing fov to zoom? 0 Answers