AI Sight / Player Follow / "Pathfinding" (Top Down)

483
484
1
2

Hold Right Click or Tap anywhere to move the Player around. If a yellow Character sees the player, it will start to follow and move around walls to get to the Player. _________________________________________________________________________ This is just a little demo of some super simplified "pathfinding"---it doesn't use any optimization methods (such as A*); instead the Player lays the path (mapped by the Waypoints). Note that this method can considerably affect game performance when used on a large scale. _________________________________________________________________________ The Characters have a 120 degree field of view, and once the Player passes through it, the Characters will start to follow the Player. There are two ways for the Characters to rotate along the path they follow: currently they are set to rotate smoothly between angles, but an alternate behavior bundle exists to make them rotate to the exact necessary angle. _________________________________________________________________________ The code here may not be the easiest to understand, though I've tried to make it as simplified as possible. Also, occasionally a Character will see the Player through a wall and will get stuck. I'm still working on finding the cause, so let me know if you have an idea on why that happens.

Editor