I’m generating a navmesh with a plane mesh and moving my player using agentGoto(), but the player model won’t decelerate quickly enough and ends up “sliding” to the destination. I’ve tried increasing the acceleration to a high number, which achieves the affect of constant speed up until the player starts to decelerate and starts “sliding” into the destination point.
I’ve also tried teleporting the agent when it gets extremely close to the destination point, but that is sometimes jarring and the player will never reach the edge of the navmesh. I noticed there are getter methods for the crowd agent’s velocity, acceleration, etc., but cannot find a way to manually set these/set a deceleration constant.
I was wondering if there was an auto-braking hook or potentially other solutions to fixing this.
Update: I wasn’t able to fix the deceleration, but I added some code that:
Ensures that the player ends on a planted foot rather than in the middle of a stride (this is done by calculating the number of steps, rounding that to the closest whole number, and modifying the animation speedRatio based on the pct difference of actual numSteps and the closest whole number)
Slow down the animation based on the velocity
Added animation blending
The deceleration still looks weird, but I guess it’s better than before
The trick I use for having a constant speed is to have a really high value for acceleration. In that case, the agent reaches the max speed very quickly. And it works for deccelation as well.
I’m trying to achieve constant speed throughout the whole crowd’s path, but now at the end of the path crowd’s moving speed starts to slow down smoothly