- Home /
mecanim run animation script trouble
Hi i have this trouble:
var Animator = Animator;
function Update(){
animations();
}
function animations(){
if (Input.GetKeyDown(KeyCode.LeftShift)) {
if (Input.GetKeyDown("W"))
{
Animator.SetBool("run", true);
}
}
}
this is my code, iam a novice in js so please dont be rude, the thing is i want to play the "run" animation when the Left Shift and the W key are pressed, the 2 at the same time like this logic:
w + shift = 1
only w = 0
only shift = 0
else = 0
or something like that... with my short knowledge of js i think that code is right, but doesnt work...
i also try this:
if ((Input.GetKeyDown(KeyCode.LeftShift))&&(Input.GetKeyDown("w"))) { ...
but doesnt work too...
in the mecanim i have just boolean parameters to make it more easier... so when you play a certain button or key, the parameter change to true or false depends on the case and the animation can crossover...
anyone can help me :( ?
Your answer
Follow this Question
Related Questions
Rotation accuracy in build 1 Answer
How do I make a sword swing? 2 Answers
How to display GUI in sequence in trigger 3 Answers
script linking 1 Answer