I've made a 2D movement script but when i jump it is very jittery once the gravity kicks in and you're still pressing W. Does anybody know how to smoothen it a bit?
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour{
public float moveSpeed = 10f;
void Update () {
float h = Input.GetAxis("Horizontal") * Time.deltaTime * moveSpeed;
float v = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
transform.Translate (new Vector3 (h, v, 0));
}
}
↧