Input axis lets your game character move smoothly instead of jumping in steps. It reads how much you press a key or move a joystick.
Input axis for smooth movement in Unity
float horizontal = Input.GetAxis("Horizontal"); float vertical = Input.GetAxis("Vertical");
"Horizontal" and "Vertical" are default input axis names in Unity for left/right and up/down controls.
Input.GetAxis returns a float between -1 and 1, showing how much the control is pressed.
float moveX = Input.GetAxis("Horizontal");
float moveY = Input.GetAxis("Vertical");
float moveX = Input.GetAxisRaw("Horizontal");
This script moves a game object smoothly based on keyboard or joystick input. The character moves left/right and forward/back smoothly using Input.GetAxis.
using UnityEngine; public class SmoothMovement : MonoBehaviour { public float speed = 5f; void Update() { float moveX = Input.GetAxis("Horizontal"); float moveZ = Input.GetAxis("Vertical"); Vector3 move = new Vector3(moveX, 0, moveZ) * speed * Time.deltaTime; transform.Translate(move, Space.World); } }
Input.GetAxis smooths input over time, so movement feels natural.
Use Input.GetAxisRaw if you want instant input without smoothing.
Always multiply by Time.deltaTime to keep movement smooth and frame-rate independent.
Input axis reads how much a control is pressed, giving smooth values between -1 and 1.
Use Input.GetAxis for smooth gradual movement in games.
Combine axis input with speed and Time.deltaTime for smooth character movement.