Sabtu, 01 Desember 2012

Path following

Guards can now be called on to find, then follow paths. Also the I took away the streamlining of the path, it was overkill to do that while drawing the path and it works better to do it while the guard walks, that way I can use his position to check if he can see any upcoming nodes as he walks and if he does, jump to those instead of any before them. The colored dev lines don't look as organized though :(
Also guard movement is smoothed so it looks pretty natural when he turns corners and along with the realtime checking for a more streamlined path it means that the movement looks a lot less node based because he doesn't need to get to the node before he turns, he just turns when he has a straight path to the next node. In the above picture you can see a non-steamlined path, the script then "sees" points one two and three drawing yellow lines to them, then because it can't see four yet it walks to three.
templates-office.com Pathfinding, Stealth