Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class PlayerMovement : MonoBehaviour
- {
- public float speed = 5f;
- CharacterController controller;
- void Start() => controller = GetComponent<CharacterController>();
- void Update()
- {
- float x = Input.GetAxis("Horizontal");
- float z = Input.GetAxis("Vertical");
- Vector3 move = transform.right * x + transform.forward * z;
- controller.Move(move * speed * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment