playMaker

Author Topic: AI(navmesh agent) flee from player  (Read 1637 times)

hoyoyo80

  • Full Member
  • ***
  • Posts: 136
AI(navmesh agent) flee from player
« on: February 24, 2019, 07:59:54 AM »
Hi all,


Im implementing an enemy type that will flee from player when player too close to them using navmesh.

For now, im multiplying player position vector3 with -1 on Z-axis. It works and the enemy move away from player direction but the problem now is, when i chase them to end/edge of navmesh they keep on trying to go to that direction.

Any help?

Thanks

Athin

  • Full Member
  • ***
  • Posts: 163
Re: AI(navmesh agent) flee from player
« Reply #1 on: February 24, 2019, 06:14:21 PM »
Hey there,

What do you intend to happen once the enemy hits the edge of the map? 

hoyoyo80

  • Full Member
  • ***
  • Posts: 136
Re: AI(navmesh agent) flee from player
« Reply #2 on: February 24, 2019, 10:49:38 PM »
Manage to do it.. I just raycast the wall and random rotate more than 45 degres and continue move away from player position.

I hope there is a neat solution for this but for my game this is suffice.

Thanks for viewing.