Help: Detect Walls with NPC
#5

Quote:
Originally Posted by NaS
Посмотреть сообщение
What TheBlackHand suggested is only a small step you have to do. It just gets the coords in front of the NPC.

What you need to do is raycast between the NPC and the destination (using CA_RayCastLine) repeatedly while moving. If a collision is found however you need to find a new direction that is possible to reach.

Also a single RayCast is not sufficient, as the feet, torso and/or head can be blocked, or the RayCast hits a small hole in an otherwise big object.
Then you also want to check if there is actually ground to walk on and how high it is. Raycast straight down from in front of the NPC and check if there is a surface to walk on.

It's not as simple as raycasting once or twice to make it perfect. There are small objects that can be missed easily and then the NPC will just ignore these objects or get stuck inside of them.

Without pathfinder it's a good idea to raycast different directions and find suitable ones, then find the one that gets the NPC closest to the destination but again, without pathfinding it's hard to traverse complex maps.
Hmmm, I'm new, should I add CA_RayCastLine to the code? could u put a example plz?. (thx for information, +rep)
Reply


Messages In This Thread
Help: Detect Walls with NPC - by bookknp - 23.08.2018, 03:59
Re: Help: Detect Walls with NPC - by TheBlackHand - 23.08.2018, 06:44
Re: Help: Detect Walls with NPC - by bookknp - 23.08.2018, 17:30
Re: Help: Detect Walls with NPC - by NaS - 23.08.2018, 18:03
Re: Help: Detect Walls with NPC - by bookknp - 23.08.2018, 18:11
Re: Help: Detect Walls with NPC - by bookknp - 27.08.2018, 00:46
Re: Help: Detect Walls with NPC - by bookknp - 30.08.2018, 21:11

Forum Jump:


Users browsing this thread: 1 Guest(s)