Thread: Recast / Detour
View Single Post
Re: Recast / Detour
Old
  (#24)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Re: Recast / Detour - 24-07-2015

Been working on improving the bot's ability to unstick themselves, but it's still a work in progress.

At the moment I've been experimenting with the idea of doing a trace from the bot's origin to their target. If it reaches then carry on, but if it hits something it runs the following calculation to work out which way to move to unblock its path:

- Get the cross product of the hit surface normal (to create a tangent line parallel to the wall)
- If the dot product of the tangent line and the target is negative, then multiply by -1 to get a line that is parallel to the wall, but also in the direction of the destination
- Move in that direction



If the obstacle is another player then the bot treats it as a cylinder (i.e the hit surface normal is directly back towards the bot).

It works fairly well, but needs a lot of tweaking. The main problem is when the bot's origin has a clear line of sight but their left or right side doesn't. I'll add extra traces to handle that.
  
Reply With Quote