If you buy 3D characters from the Set Store, there are 2 kinds of moving animations.

One thing is that the character moves forward.

Another thing is that in reality, it does not move forward, but only takes motion that moves.

FSM should be created to match the characteristics of the animation.

If you are a character with moving forward animation, you can easily create FSM.

The random float, set Animator Speed was used to give the moving speed of the enemy

Use the smooth look at to make the enemy look at the player.

Calculate the distance to the player using the find closure.

I switched to the next move after a 3.5m proximity for the proximity character.

Change to attack animation after 3.5m proximity.

The animator of the enemy made it simple.

Parameter : Chase is a bool attack is a trigger

Add the transition in the same way as below.

Trigger an attack when changing to an attack animation.

When enemy move chase bool.

You will be able to see that the character moves well just by changing the state value of the animation.

If the character is an anime that has not moved forward, navmesh should be used.

Put a navy surface on the floor where the character will move

Press the Bake button.

The space where the character can move is shown in blue.

Put a naveesh agent in the character.

Add a 3d object to the map.

Change name to NavPoint

Use set agent Destination as game object.

Put the 3d object in the destination.

You can see that the enemy moves well with navpoit as shown below.

Similar Posts