var player: Transform;
function Start(){
player = GameObject.FindWithTag("Player").transform;
}
function Update() {
GetComponent(NavMeshAgent).destination = player.position;
}
Now,how can i make AI RUN AWAY From Player. Just Run away from player with navmesh. I know i have to get player vector and then i have to make an Ai to move there. Or maybe there is an other option?
Help me out smart people!
No,i dont need a specific point,i need ai to run away from player without points,it is possible if player vector is found and then somehow make ai run to that player vector point,so there is no specific NavMesh targets,like waypoints or anything…
Thanks for reply anyway
Yes, you do need a specific point. You need to feed the agent a target position.
Just subtract the enemy.position from the player.position to get a direction and multiply the normal of that and add the enemy.position to get a point away from the player/
If you wanted you could use a modified Dijkstra algorithm to find the optimal path away from the player. You could build this to take into account distance, cover, terrain and so forth.