Hello! I have a player with character controller and i set it to move forward all the time,now i want when player triggers something to change the direction to right(i know how to do the trigger part i just dont know how to do the direction part). It’s an endless runner game. Please help i can’t find any good videos for character controller turning.
Here is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMotor : MonoBehaviour {
private CharacterController controller;
private float speed = 5.0f;
// Use this for initialization
void Start () {
controller = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update () {
controller.Move(Vector3.forward * Time.deltaTime * speed);
}
}