The question is answered, right answer was accepted
Help with TopDownGame and mouse position following
I have a script that makes the player follow the mouse, and a GUI that pops out as a pause menu. Is there any way I can make the player not teleport to the mouse when I hit the resume button.
Edit: Maybe I wasn't clear with my question. I apologize for that. Searching, I found someone that had my same problem and they were discussing a solution which I do not understand. Something about GetAxis and GetAxisRaw. If someone could be kind enough to explain it to me I would really appreciate it.
User who had the same problem https://www.reddit.com/r/Unity3D/comments/1u0zpt/controlling_the_mouse_position/
Answer by TGMM · Feb 11, 2016 at 09:58 PM
Finally got it.
void FixedUpdate()
{
gameObject.transform.position = new Vector3(gameObject.transform.position.x + Input.GetAxisRaw("Mouse X") * speed, gameObject.transform.position.y + Input.GetAxisRaw("Mouse Y") * speed);
}
Follow this Question
Related Questions
How can I implement limits to my player so it doesn't come out of the main camera? 0 Answers
Orbit position controlled by mouse 2D (C#) 0 Answers
Shoot bullet towards mouse 0 Answers
top down 2d game, aim weapon with mouse. please help 1 Answer
Character rotation, only happens when mouse is rotated around world centre (0,0,0) 0 Answers