- Home /
Using Mechanim for FP Animation - Help
I'm finally making progress on my First Person game, but now I need to know how to use Mechanim for FP animations. I have an "Idle" animation set up as the default animation on my Right Hand in Mechanim, I also have 2 Swing animations for my Right Hand which have a condition set up using an Int, if the Int is 0, the default animation is playing, if the Int becomes 1, the first swing animation is played, if the Int becomes 2, the second animation is played, both set to return to the Idle animation with Exit Time. The Int variable is called "Attack" in the script I want to use, but I don't know how to access the Parameters in Mechanim using this script. Could someone please help me ASAP? Here's the script I'm using to change the Int value based on an input on my controller:
function Update()
{
if(Input.GetAxis("Fire1") && attack == 0)
{
attack = 1;
attacktime = 2.0;
}
if(Input.GetAxis("Fire1") && attack == 1)
{
attack = 2;
}
if(attacktime > 0.0)
{
attacktime -= 1.0 * Time.deltaTime;
}
if(attacktime < 0.0)
{
attacktime = 0.0;
}
if(attacktime == 0.0)
{
attack = 0;
}
}
Judging by the Mechanim tutorial with the Robot on YouTube, you need a few lines of Code that access this parameter in Mechanim. I'd love it if someone could re-write my code so that it accesses this "Attack" (Int) Parameter.
Thanks in Advance,
Trevor
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
problem with FindWithTag 2 Answers
AI movment script funtion start error ? 1 Answer
Digital Clock: Time.time > 60 2 Answers
Need Help Fixing WeaponScript *(cant find compiler error) 1 Answer