My character have a rigidbody and using a third person controller to make it move. I have add some script to let the character cannot move and attack when it get hit by enemy.
After that, when it get hitted it seems have an inertia so that it is playing my “hit” animation and sliding towards a direction which I get hit before.
How can I solved this sliding problem?
I have try to put the below script when the player is play hit and attack animation.
rigidbody.velocity = Vector3.zero;
But it is not work and still sliding away from the last position.