# Top Down Keyboard Smooth rotation

Hi,

Im sorry I know this question was posted many times, but every solution I try, it wont work out :(((( im kinda desperate right now...

I have a top down game (axis) : y -> up/down, x -> left/right, z->in/out (not used for game)

Now the Controls:

```
float moveH = Input.GetAxis("Horizontal");
float moveV = Input.GetAxis("Vertical");
```

I want my playermodel turn into the keyboard direction. Best would be that when the player is facing top he has to do a half circle to go down, but that would be a luxury...

my solution:

```
Vector3 top = new Vector3(transform.position.x, transform.position.y + 10F, transform.position.z);
Vector3 down = new Vector3(transform.position.x, transform.position.y -10F, transform.position.z);
Vector3 left = new Vector3(transform.position.x-10F, transform.position.y, transform.position.z);
Vector3 right = new Vector3(transform.position.x+10F, transform.position.y, transform.position.z);
if(Input.GetKey(KeyCode.UpArrow)){
transform.LookAt(top);
}
if(Input.GetKey(KeyCode.DownArrow)){
transform.LookAt(down, -Vector3.forward);
}
if(Input.GetKey(KeyCode.LeftArrow)){
transform.LookAt(left, -Vector3.forward);
}
if(Input.GetKey(KeyCode.RightArrow)){
transform.LookAt(right, -Vector3.forward);
}
```

Every solution I tried f***ed my axis up. I never met the right ones... Except exactly this one

Would be great if anyone could help me

**Answer** by Asdf11x
·
Jun 09, 2016 at 09:17 AM

I made a solution which works. Its pretty straight forward. But it isnt possible to have you character look only a bit to one side. The player will always rotate fully to the given coordinates, maybe I m gonna find out how it works, to rotate only a little bit. But this is great for now

```
if (Input.GetKey (KeyCode.UpArrow)) {
qTo = Quaternion.Euler (-90, 0, 0);
}
if (Input.GetKey (KeyCode.DownArrow)) {
qTo = Quaternion.Euler (90, 180, 0);
}
if (Input.GetKey (KeyCode.LeftArrow)) {
qTo = Quaternion.Euler (0, 270, 90);
}
if (Input.GetKey (KeyCode.RightArrow)) {
qTo = Quaternion.Euler (0, 90, 270);
}
if (Input.GetKey (KeyCode.UpArrow) && Input.GetKey (KeyCode.LeftArrow)) {
qTo = Quaternion.Euler (315, 270, 90);
}
if (Input.GetKey (KeyCode.UpArrow) && Input.GetKey (KeyCode.RightArrow)) {
qTo = Quaternion.Euler (315, 90, 270);
}
if (Input.GetKey (KeyCode.DownArrow) && Input.GetKey (KeyCode.LeftArrow)) {
qTo = Quaternion.Euler (45, 270, 90);
}
if (Input.GetKey (KeyCode.DownArrow) && Input.GetKey (KeyCode.RightArrow)) {
qTo = Quaternion.Euler (45, 90, 270);
}
transform.rotation = Quaternion.RotateTowards (transform.rotation, qTo, speedQuad * Time.deltaTime);
```

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

How to make an skidmarks system on a 2D top-down car sprite? 0 Answers

[2D] Make player push object 1 Answer

New user question about 2D top down game and collision. 0 Answers

LookAt method is stuck on one axis, Why? 0 Answers

Top-down Room based dungeon: darken the rooms the player isn't in 0 Answers