Slight jump at beginning of path

Hi there,

I’m using a class I’ve built on top of the AIPath class and I’ve noticed that between receiving a new path and starting to navigate it, the agent does a slight jump towards the start of the path (I’m not sure why the start of the path is slightly away from the stationary agent in the first place? Perhaps node size?).

I had thought the two calls to MoveToLocallyClosestPoint in OnPathComplete were trying to solve this. However they don’t appear to be. Is there some settings I’m perhaps missing which will stop the agent doing a small jolt towards the start position before walking correctly along the path?

Also is there any reason you can think of that would make the path’s start position be roughly a node away from the requested position? I’ve double checked my code and I’m definitely calling the start position from transform.position.

Thanks!

Hi

Do you have a video/screenshot of this?

Sure do!

Slowed down (50%): https://www.dropbox.com/s/ndhr3gemmb7troq/Path-beginning-jolt-0.5x.gif?dl=1
Normal speed: https://www.dropbox.com/s/5tvml8qfwnfhhm4/Path-beginning-jolt-1x.gif?dl=1

You can see the jolt just after he stops near the path end.

Hm… It looks like the path has been calculated from the previous target to the new target, instead of from the agent’s current position to the new target.
In your subclass, have you changed how the paths are calculated?

It’s technically a new class, as opposed to a subclass. But I copied the original into it and then changed it to suit my needs. Technically I have changed how they’re calculated, but I still couldn’t make sense of why there was that wobble. However I have since made some other changes and it appears to have gone away, so… victory? Hehe. Thanks for your help!

1 Like