You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
391 B
C#
22 lines
391 B
C#
2 months ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
|
||
|
public class MovementScript : MonoBehaviour
|
||
|
{
|
||
|
public float speed = 10.0f;
|
||
|
CharacterController cc;
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
cc = GetComponent<CharacterController>();
|
||
|
}
|
||
|
|
||
|
void FixedUpdate()
|
||
|
{
|
||
|
Vector3 move = Vector3.zero;
|
||
|
move.x = Input.GetAxis("Horizontal") * speed;
|
||
|
move.z = Input.GetAxis("Vertical") * speed;
|
||
|
cc.SimpleMove(move);
|
||
|
}
|
||
|
}
|