Freezing the player controller.

He everyone,

I’m freezing the player controller in some parts of my game, and some of the stuff happening around the player is based on his velocity.

The strange part is, when I freeze the player, his velocity stays high.

I freeze the player by performing all the movement and gravity code in:

if (isFrozen == false){
     //movement code
}

so when “isFrozen = true”, the movement stops, but for some reason the character controllers velocity is still extremely high.

How can I make the code so unity will detext the correct velocity?

thanks!

Hello!

You might want to set it everytime you freeze it to 0.

|
|
V

Not sure,tho,since i haven’t worked with cotrollers too often.Hope this helps!

Are you using the CharacterMotor?

if (isFrozen == false){
//movement code
}
or
if (!isFrozen){
//movement code
}

@tedchirvasiu07
I can not set the velocity to zero because it is read only. I disable all the movement, so the player is not moving at all in any direction, but it still thinks it is moving because the velocity it from the last frame, I think…

@legend411
I’m using a regular character controller, nothing fancy.

@PressAnyKeyToPlay();
Little mistype in my post :wink:

Anyone?