Рухи перс., клавішиі та стіни

// Add Component -> Physics -> Character controller

// 2 - вперед, назад, обертання вліво і вправо

public float speed = 2.0f;

private CharacterController control = null;

void Awake () {

control = GetComponent<CharacterController>();

}

void FixedUpdate () {     //  Time.deltaTime, гавітація, стіни

float v = Input.GetAxis("Vertical") * speed;

float h = Input.GetAxis("Horizontal") * speed;

transform.rotation *= Quaternion.Euler(0f, 20 * h * Time.deltaTime, 0f);

control.SimpleMove(transform.forward * v );

}