using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
public float moveSpeed = 100f;
private CharacterController controller;
void Start()
{
controller = GetComponent & lt; CharacterController & gt;();
}
void Update()
{
Vector3 moveDirection = new Vector3(0, 0, constantMotion);
moveDirection.x = Input.GetAxis("Horizontal") * moveSpeed;
moveDirection.y = Input.GetAxis("Vertical") * moveSpeed;
controller.Move(moveDirection * Time.deltaTime);
}
}
}
↧