- Home /
Question by
finalg · Mar 06, 2012 at 11:30 PM ·
raycastnavmeshpathfinding
Trace a visible ray between two NavMeshAgent (Raycast)
Hi everyone,
I appreciate the new functionnality of Unity for Navmesh and Pathfinding.
Currently,I know how to use NavMesh Agent and deplace a gameobject toward another gameobject.
Now, I want to trace a visible ray, a trace, between these two agents, like in a GPS. In the documentation, I see this function NavMeshAgent.Raycast but I don't know how to use it.
public class TestNavScript : MonoBehaviour {
public Transform target;
private NavMeshAgent NavComponent;
private NavMeshHit hit;
// Update is called once per frame
void Update () {
GetComponent<NavMeshAgent>().destination=target.position;
GetComponent<NavMeshAgent>().Raycast(target.position,out hit);
}
}
After, I will put a mesh on this ray.
Can you help me, please?
Comment
Your answer
Follow this Question
Related Questions
Trace a ray between two game bject ( Nav Mesh)? 0 Answers
AI on dynamic navmeshes and moving platforms? (Drawbridges, Elevators, Monorail trains, etc) 1 Answer
Recentering an infinite world that has a NavMesh. 0 Answers
Issues with Navmesh Pathfinding and casting a Ray on a transform position 0 Answers