using UnityEngine; public class CubeMovement : MonoBehaviour { public float moveSpeed = 5f; private void Update() { // Get input for movement in both horizontal and vertical axes float horizontalInput = Input.GetAxis("Horizontal"); float verticalInput = Input.GetAxis("Vertical"); // Calculate the movement direction based on input Vector3 movementDirection = new Vector3(horizontalInput, 0f, verticalInput).normalized; // Move the cube in the calculated direction transform.Translate(movementDirection * moveSpeed * Time.deltaTime); } }