playMaker

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

hoyoyo80

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
AI(navmesh agent) flee from player
« on: February 24, 2019, 05: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: 103
    • View Profile
Re: AI(navmesh agent) flee from player
« Reply #1 on: February 24, 2019, 04:14:21 PM »
Hey there,

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

hoyoyo80

  • Junior Playmaker
  • **
  • Posts: 74
    • View Profile
Re: AI(navmesh agent) flee from player
« Reply #2 on: February 24, 2019, 08: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.