Enemy NaveMesh

I was having a hard time getting the “enemy” (cone) to stop before the collider collided with the player (cube), so I did what here in Brazil we call “Gambiarra” (it’s improvisations) and the result was that:

Basically they are two cubes, one of them is navagent and goes to the player when he is at a specified distance, the second (the cube behind), is in parent with him, then the enemy (the cone) is in navangente following the parent cube ( using “On Update”, because we always want him to follow this cube), so we have no problem with the enemy n bugging the parents.

Tomorrow I should record a video showing how I did it with audio in Portuguese for my followers, if anyone wants me to make a video in English too, just write the request here in the comments.


I had problems with the enemy’s Z vector putting it as NavAgent, to solve that I put a “set Transform” node, to receive from the second cube (which is parenting with NavAgent) the X & Y vectors, receiving from it the ‘Z’ '(this was important for node “set transform” not to set the value 0 to vector Z).
I had problem with node “remove object” too, if I remove an object with NavAgent script the game crashes.

1 Like