#UNITY MINIMAP AND GPS help?
1 messages · Page 1 of 1 (latest)
What have you tried so far
I'm trying to make a minimap where the route to the player's objective is shown and as I advance the route is erased, if you can help me I would really appreciate it 😄 I've spent the day looking for information
@pallid plume
Maybe try a line renderer?
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.AI;
public class GpsManager : MonoBehaviour
{
//NAVEMESH
public NavMeshAgent agent;
public LineRenderer line;
public List<Vector3> point;
public GameManager gameManager;
// Start is called before the first frame update
public bool isGPSActive = true; // Variable para controlar el estado del GPS
public float intervalo = 0.5f;
void Start()
{
//NAVEMESH
agent = GetComponent<NavMeshAgent>();
line = GetComponent<LineRenderer>();
}
private void Update()
{
agent.SetDestination(gameManager.currentDeliveryLocation);
DisplayLineDestination();
}
private void DisplayLineDestination()
{
if (agent.path.corners.Length < 2 ) return;
{
int i = 1;
while (i < agent.path.corners.Length)
{
line.positionCount = agent.path.corners.Length;
point = agent.path.corners.ToList();
for (int j = 0; j < point.Count; j++)
{
line.SetPosition(j,point[j]);
}
i++;
}
}
}
}
This is my code but it has a problem and that is that it bugs when the third address appears