Hey Guys, im trying to archieve the following:
-if you collide with a door, you can hit a button, then your mouse and movement freezes and your player automaticaly opens the door by animation, but should be unfreezed when the animation is done.
So here we go, i don’t have any problems with the Doorcollider or the Key Input.
What i need your help for now, is:
- Freezing Mouse Movement and WASD (Character Controller Movement), as well as it’s rotation
- After finishing the animation, everything should be unfreezed
Btw: does anyone know how to make a countdown in javascript? Btw i forgot to say, this whole tophic is about javascript:)
Make a variable: var AnimationIsPlaying = false; Then when the AnimationIsPlaying, AnimationIsPlaying = true. Then put an if around all the movement, so
if(AnimationIsPlaying = false)
{
move;
}
This should stop movement.
make a var named countdown or whatever. during update, set var countdown – or -1. have an if statment to tell when var countdown == 0 and do what ever you want it to then.
just off the top of my head, but give it a try.
Im using several scripts right now with countdowns. Here how I do it:
var timer = 10.0;
var countdown = 1.0;
function Update()
{
if (timer > 0)
{
timer -= countdown * Time.deltaTime;
}
}
somebody any ideas about the movement freeze script?