using System; using UnityEngine; public class PlayerMove : MonoBehaviour { [SerializeField] private float speed; [SerializeField] private Rigidbody rb; [SerializeField] private Vector3 StartPos; private void Start() { rb = GetComponent(); } void Update() { float horizontalInput = Input.GetAxis("Horizontal"); float verticalInput = Input.GetAxis("Vertical"); Vector3 moveDirection = new Vector3(horizontalInput,0, verticalInput); moveDirection.Normalize(); transform.Translate(moveDirection * speed * Time.deltaTime, Space.World); } public void Reset() { this.transform.position = StartPos; } }