ItsMeLucifer

UNITY Player Movement with CharacterController

Oct 18th, 2021
888
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PlayerMovement : MonoBehaviour
  6. {
  7.     private CharacterController characterController;
  8.     public float speed = 0.05f;
  9.     void Start()
  10.     {
  11.         characterController = GetComponent<CharacterController>();
  12.     }
  13.     void Update()
  14.     {
  15.         Vector3 inputMovement = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
  16.         characterController.Move(inputMovement * speed * Time.deltaTime);
  17.     }
  18. }
  19.  
RAW Paste Data