- Home /
Rotate and Move towards Mouse Point
I am trying to apply forward movement and rotation, however I can not get the two to mix. So far, only rotation works the way it should. Forward movement, under a Character Controller .move, ignores the rotation and keeps going straight.
My code so far stands as:
transform.LookAt(posistion);
transform.rotation = Quaternion.Euler(new Vector3(0, transform.rotation.eulerAngles.y, 0));
Vector3 mover = new Vector3(0,0,3);
mover = mover * Time.deltaTime * 4;
controller.Move(mover);
Posistion represents the actual mouse, and I'm rotating along the Y axis for a top-down game. The mouse controls where the player goes, although not by clicking.
Comment
Your answer
Follow this Question
Related Questions
Rotation in 8 way direction 2 Answers
how do i Limit camera rotation on Y-Axis? 2 Answers
transfrom.Rotate changes z axis incorrectly 2 Answers
How to make an object rotate on the y axis towards the mouse? 3 Answers
Lock the Camera's Y Rotation Axis? 0 Answers