I have modified the NavMeshAgent stopping distance to 5. When I disable the collider of Lion, Player can run through their body (picture below) and when I enable Collider, Player was pushed and “fly”. How to solve this? Thank you. Sorry for my English.
You can calculate the distance between the player and the lion center, than stop the lion navmesh agent when the distance is below a a certain value to be sure the lion will stop moving.
Thank you. But when I move to attack the lion, my character’s collider was pushed and he started “flying”. And when I stopped the NavmeshAgent, the “Attack” animation (no root motion) of the lion make it translate forward a bit.
Without seeing your character physics set up it is hard to figure out what is going on. Is your lion script adding some force to the player when it attacks ?
You can trying chaing the character mass and see what happens, or simply force the character position to stay at it’s last position (the position before he was attacking) and disable character physics.
You can force the lion to stay at it’s last position before attacking by code in the update function.
Or you must correct the animation to make it root motion.