- I would love to make a tank game with this sort of movement does anyone know how to get this kind of movement? This is the script I have currently but it doesnt act like tank movement
public class PlayerMovement : MonoBehaviour {
public float moveSpeed;
// Use this for initialization
void Start () {
moveSpeed = .5f;
}
// Update is called once per frame
void Update () {
float moveHorizontal = Input.GetAxisRaw("Horizontal");
float moveVertical = Input.GetAxisRaw("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
if (movement != Vector3.zero) transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(movement.normalized), 0.05f);
transform.Translate(movement * moveSpeed * Time.deltaTime, Space.World);
}
}