- Home /
Reload/Shoot Animation
Hi All,
I know this question has been asked for a lot of times, but for me most of the answers are a little unclear.
I want to be able to use animations in Unity3D. So most people advised to create the animations in 3D Studio Max, as that is the program I used to create my gun.
Okay, no problem. I animate that gun beautifully :P, but still no info on how to add this in Unity. On another thread, someone mentioned that I would have to call the animation upon the reload button is being pressed or the ammoclip is empty. I understand that, and I think it would be working just fine, if I knew how.
I just need to know how to name my animations in Max so I can call them as an event in Unity 3D.
Or do I need to save my animations in 3 different files? (Idle, Shoot, Reload) That might slow it down, I think.
Anyway, could you point me into the right direction of naming my animations in Max or Unity 3D?
Cheers!
Answer by Bablo · Mar 04, 2011 at 01:47 PM
You need to know which frames in 3dsmax are used for which animation, for example, if you have the shooting animation in 0-20 and the reload in 21-40. Then when you import the model to unity, you need to tell unity, which frames have which animation, in Inspector->(FBXImporter)->Animations.
Then, when you have added all the wanted animations in there, you can see the animations in your project tab with their corresponding names. Now you can go to your character/weapon and add the animations through the inspector. When you have added all the animations you need, you can call them for example with a script like this(that one is just from one of my characters, but you get the point):
if(Input.GetAxis("Vertical")!=0 || Input.GetAxis("Horizontal")!=0)
{
animation.Play("run");
}
else
{
animation.Play("idle");
}
Answer by Kashaunzilla · Apr 17, 2011 at 04:44 PM
Well if you are trying to name the animations split them up and import everything to unity and then you can rename them from there instead of having them animation, animation1, and animation2.
Answer by sunil1 · Jun 23, 2016 at 02:11 PM
Publilc AnimationClip Walk; ppublic AniamtionClip idle; Public Animtion An; Public Rigidbody Rb;
void Update {
if(Input.GetAxis("Vertical")!=0 || Input.GetAxis("Horizontal")!=0) { animation.Play("run"); } else { animation.Play("idle"); } } public void playAnim(string animName) { an.CrossFade(animName); } public void stopAnim() { an.Stop (); }
Your answer
Follow this Question
Related Questions
Reloading script 1 Answer
Wrote a script for Shooting, reloading and to display the AMMO in a GUIText 1 Answer
No Reload Script Works 1 Answer
How do I make a gun project a particle? 1 Answer
arms with gun and animation 1 Answer