# Movement Help

Hello, I’m been trying to create a action game like movement.

So far I big doing a lot research on this, like from
and so on. The way it look like to me that when you hit W your character move up and it rotation you up
when you hit S it rotation the character down so he facing the camera and move down. The A and D key
make the character turn that way and move that way. I script this and it worker good. the error come from
when I’m trying to make the 45 angle one. like WD, WA, SA, SD, I can’t come up with how the player slower rotation to that point.

By the way I’m using transform.eulerAngles to rotation the character and before that it check if( transform.eulerAngles.y != 90){ change transform.eulerAngles.y to 90;

PLZ HELP

I am working on a top down type of game to and I have the script for the player movement.

``````using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour
{
public float Speed = 15;
public float RotSpeed = 180;

void FixedUpdate()
{
//ROTATING
Quaternion rot = transform.rotation;
float z = rot.eulerAngles.z;
z -= Input.GetAxis ("Horizontal") * RotSpeed * Time.deltaTime;
rot = Quaternion.Euler (0, 0, z);
transform.rotation = rot;

//MOVING
Vector3 pos = transform.position;
Vector3 velocity = new Vector3(0, Input.GetAxis ("Vertical") * Speed * Time.deltaTime, 0);
pos += rot * velocity;
transform.position = pos;
}
}
``````

Just add this to what you want to move and it should work.
Let me know if this worked for you!

I would assume that you want smoothing involved, consider using Mathf.SmoothDamp