Confused about animations
I've tried searching around and I find some answers which never seem to explain this to me fully. Some are simply outdated and others don't explain what's happening.
What I want to know is what are my options when making animations?
Can I make animations directly in unity (using the "Animations" component)?
When making animations in 3d software (I use Blender), how would I go about animating and scripting (C#) different weapons and such?
How does the animation scripting go? I've seen some examples that are simply animation.Play(), which doesn't seem to do anything and doesn't really make sense to me and others which have got to do with the "Animator" component. I'm using C#, if that wasn't clear by now.
A little insight into what I'm doing right now: I'm doing a little test project, I've scripted a first person Rigidbody controller and made a simple axe using the in-engine shapes. What I'm looking for is animating the axe to do a chopping animation when I hit left click. I also want to set it up so I can switch between weapons and/or tools and have an animation on the rest of them as well.
Complicated answers are fine as this project is aimed at improving my skills and knowledge with unity and C#, all I want to ask is for a detailed answer or documentation which explains the process used.
Answer by Baste · Aug 24, 2015 at 12:56 PM
First of all: You can make animations directly in Unity with the Animations window. It's sufficient for things like moving doors or platforms, but if you're trying to animate a character, you'll need to get an actual animation program rather than trying to use that. It's simply too simplistic to get something like a decent walking animation done without a ton of extra work.
Unity used to base animations on the Animation component. Development was stopped on that in favor of the animator component. There have been several discussions (read: tons of flame wars) over if that was a good idea or not. Unity internally considers it to be deprecated. That does not count for the Animation window - just the component. Yes, this is confusing.
The old Animation component was simply a list of animation clips. You sent it the name of the clip it should play from your script, and that was it.
The Animator, on the other hand, is a wrapper around a state machine setup. You create the state machine (an Animator Controller), use the Animator window to mess with it, and an Animator component to use it. You transition between states from scripts by sending trigger messages and setting variables on your animator.
You should read through this part of the docs, as it goes into depth on all of the components and how they work.
That's very informative, I know a little bit around the Animator in Unity, but I should probably read it more thoroughly. I've used blender to create a very simple humanoid and animated it using Blender animations and then using Animator to get the movements I want. Since the Animator seems to be the best option, the question that I have now is about the part with multiple weapons or tools. When I have multiple items that I can switch between, how would I go about animating them? Should I use my model in Blender and animate them as if the model was holding them and then export the whole thing with multiple different item animations in a long animation sequence or is there a simpler way to handle that?
If you can get away with the same animation for different tools, simply create the animations without the tools (or with a placeholder tool), and then attach them to the hand bone in the correct orientation and rotation. Use scripting to set which tool is currently active.
You could also create the animations in a way where your characters are holding all of them at the same time, and then deactivate the ones you're not using.
Oh, that's actually really clever. I think I got my answer. Thank you so much! :)