i need help with my waypoint system! I didnt make this script and i dont know what to change.
right now the character goes towards the waypoint perfectly, but i need him to POINT towards the next waypoint. is there a way to do this? here is the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Waypoint : MonoBehaviour
{
public GameObject waypoints;
int current = 0;
float rotspeed;
public float speed;
float WPradius = 1;
void Update()
{
if (Vector3.Distance(waypoints[current].transform.position, transform.position) < WPradius)
{
current++;
if (current >= waypoints.Length)
{
current = 0;
}
}
transform.position = Vector3.MoveTowards(transform.position, waypoints[current].transform.position, Time.deltaTime * speed);
}
}