How to halt all other movement during an attack

I currently have a third person game in which my character can successfully run, jump, sprint and attack. It is an edit of the 3rd person controller script altered to accommodate a simple kick animation when the left mouse button is clicked. The issue is, the kick is meant to be performed while standing still, so if i am moving at all when i decide to kick, the character appears to slide across the ground. Is there any way for me to halt all directional movement for when the character is kicking? If so, can that same principle be used to make it so that the character cannot kick when he is in mid-air?

Any help is much appreciated.


I think you need to add constraints… Im not sure how to do this… I tired looking in the referencesm but perhaps you could do something like

function Update(){

    if Input.GetAxisRaw("kick"){

       Input.GetAxisRaw("Horizontal") =     false;

       Input.GetAxisRaw("Vertical") = false;


    else {
                  Input.GetAxisRaw("Horizontal") =     true;

       Input.GetAxisRaw("Vertical") = true;

yes u can stop ur char from moving. u can make a bool and

//stop ur movement


or u can place ur movement controllers inside the kicking if


    //movement controllers
    }else if(isGrounded && input.GetButtonDown("Fire1"))
    kickin= true;
    kickin= false;

if u r using character controller. you can make an if statement using isGrounded
this way u can kick only if u r on the ground.

I think This may Help You Stoping Character I’ve used it for my own script which was not edited version of 3rd Person Controller And the guy was a runner And it answered The character Stops !!



	motor.inputMoveDirection = Vector3(0,0,0);
//Your Code Here