The player reaches the destination using the navmesh agent, animation transition is not triggered using SetBool in Unity3d.

Object: Fixing the Player Movement system.

Before doing this let's see how my code and the name of my parameter change the state, the parameter is a bool type.

In the first step, let's play the game and see the problem.

the player stops, but the animation keeps playing

In the second step, let's add debug inside the condition where we check the distance.

If we play we will see the debug is not called, this tells us this condition is false.

In this step, let us move the debug code outside, we do this to make sure the code to calculate distance is working.

Let's play unity, now we see the distance is calculated and the player is stopped at the distance of 1.98. This means the condition is false since we want to stop when the distance is less than one so this show the condition is false.

Now select the player and open navmesh by going to window<AI<Navmesh. Now go to the scene view and check if we have any bake errors.

Note: For the player to stop walking is when green cylinder colliders to map with a red circle mark on the ground, but due to some places is not baked the player can't move.

In this step, let's move the player and see the mapping of the navmesh collider and red circle which means it's the destination of the player.

This shows player reaches the destination of the navmesh agent but the distance value is not zero.

Note: Green cylinder collider map with red but idle animation is not triggered due to the distance being greater than the stop distance of the navmesh agent. So seem the player does not reach the destination for the condition to be true.

The player stops at this distance he does not reach the destination 100%
you may say let's put 2 here and put 2 at a stop distance..maybe??

In this step lets, make the player model touch the ground and the parent player object touches the ground and set the base offset to 1. When you make the player parent touch the ground make sure the cylinder collider does not go inside the floor and make Daren touch the floor.

you can return the debug inside the if which checks the distance to know if the condition is true now

Now play the editor, this is how I solve this issue,

See you in the next article

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Suleiman Abdullah

Self taught Unity Developer, who is passion about making games ,and he loves Math For Game Development