A* Pathfinding Project

Penalty Problems


#1

Hi there,

I have this character inside a house and want it to go upstairs. I have already implemented a system that makes the player go up/down a ladder as soon as it gets close to it.


In the picture you can see in green the path that is calculated, which seems correct. At runtime I have a penalty of 999 for all nodes but the ones at the bottom and the top of the ladder which have a 0 penalty.

But the character never reachs the base of the ladder and follows the red arrow path (I assume is trying to get close to the final desitionation which is upstairs).

Shouldn’t it get close to the ladder nodes since they have no penalties? Any other way I can fix this?

Btw, I run a debug.log to make sure the penalties for the nodes were correct and it seems so, although I have set up in the setting of Astar to show grading graph for penalties and still shows it up all green.

Thanks


#2

Sorry to bump this but still haven’t solved it


#3

Hi

Sorry for the late answer.
It looks from your red curve there that the agent is following the path very loosely. Perhaps you could reduce the ‘pick next waypoint distance’ (or reduce the smoothing if you have any smoothing modifiers attached) and that will make it follow the path more precisely.

The AIPath script has no direct support for off mesh links which is why this is a bit tricky. Ideally the agent would treat the bottom of the ladder as the endpoint of the path and make sure to reach it precisely. As it is right now it just sees it as another waypoint along the path and it may follow it a bit loosely.