- Home /
Question by
finalg · Mar 06, 2012 at 11:28 PM ·
raycastnavmeshpathfinding
Trace a ray between two game bject ( Nav Mesh)?
Hi everyone,
I appreciate the new functionnability of UNity 3.5 for navmesh and pathfinding
I know how to use NavMeshAgent to attract a gameobject thanks to navmesh. However, I want to make a visible trace between these gameobject like in a GPS.
I see a raycast function for NavMeshAgent components, but I don't see it in my scene...
public class NavTestScript : MonoBehaviour {
public Transform target;
private NavMeshHit hit;
// Update is called once per frame
void Update () {
GetComponent<NavMeshAgent>().destination = target.position;
GetComponent<NavMeshAgent>().Raycast(target.position, out hit);
}
}
Can you help me?
Comment