- Home /
Player Animation change when pickup Weapon
Hello there :) I'm making character animation set via code. The goal is when character pick weapon his Idle and Walk animations must change. The problem is... they don't change :/ Can anybody help me with this problem?
Code:
#pragma strict
var equip : boolean;
var find : boolean;
function Update ()
{
if (Input.GetAxis("Vertical"))
{
animation.CrossFade("WALK");
}
else if(Input.GetAxis("Horizontal"))
{
animation.CrossFade("WALK");
}
else
{
animation.CrossFade("IDLE");
}
if (find == true) {
if (Input.GetKeyDown("e")) {
equip = !equip;
}
}
if (equip == true){
if (Input.GetAxis("Vertical"))
{
animation.CrossFade("WeaponWALK");
}
else if(Input.GetAxis("Horizontal"))
{
animation.CrossFade("WeaponWALK");
}
else
{
animation.CrossFade("WeaponIDLE");
}
}
}
function onTriggerEnter (weaponCol : Collider)
{
if (weaponCol.gameObject.tag == "Weapon") {
(find) = true;
}
}
Comment
Your answer
Follow this Question
Related Questions
Change player's y-position for a specific animation 1 Answer
How can I detect if box is touching a tag named weapon? 1 Answer
How to make player have the ability to pickup and read a book (like in Skyrim) 5 Answers
How do I fix my gun animation 0 Answers
How to change motion/animation in Animator with C# script? 0 Answers