Animation import? Player and gun together or separate? How does Unity know when to play that animation?

Hello everyone,

Two weeks ago I installed unity, and i have watched all days lots of tutorials and stuff, (willgoldstone has really nice beginner tuts) but, now, I have made lots of plans for my new game, but i will first practise and test a lot, im making a 2d game, and i want to learn how to work with animations and stuff, now i wanted to learn how to make player that has a weapon that can shoot and reload in unity with help of maya, to learn 3d modelling and animating, and learn how to import all the animations in Unity3D and let the player shoot and stuff, but however, I searched everywhere on Google, Youtube and this forum, but i dont know:

  1. Must i make the player together with the guns or can i model them separate, so make a player in maya and in another project/scene the gun? Yes, I want later (when done with this, and like to practice further :slight_smile: to use more guns in the game with a shop and upgrade system to buy new guns etc…

A. If they have to be modelled and animated separate (asked in question 1), how to make the gun reloading? Animate the player and the gun separate? How?(size, rotating, position with hands and gun??) And how to put the gun and player together in Unity3d?

Or B. If have to make and animate the player and gun together, do you have to replace the player when changing the weapon?

2nd. How to import animations? can you export them separate from maya? and how does unity know when to use that animation? Example, reloading weapon… I dont understand anything from that animation import system at all…

Thanks in advance,
Hopefully someone has time to tell me how, or give me a link to a (video)tutorial, thread or something like that.

And yes, i have done the lerpz tutorial, but didnt really understand it because they made and imported the animations already :S

It depends usually on how you plan to use things. You certainly -can- animate player & weapon together. If you have multiple weapons, though, or if the weapon can appear separately, it’s best to model it separately. You can sync animations easily enough - build them the same length in your animation program, and start them at the same time in Unity.

You can use transform.parent to lock the weapon’s position in relative to the player - I’d recommend making the actual weapon only animate “relative to itself” - meaning, it has its firing animation and maybe its eject-clip animation, but the weapon itself doesn’t move around a lot. If you have, say, a Halo energy sword “turning on” animation, don’t rotate the model in its animation, just expand the energy part of the sword. Then you can parent the weapon’s grip to the player’s hand, and as the player does things, the weapon sticks to their hand and points in the right direction ‘automagically.’

I’ve always worked with FBX files, which have animations built into them. There are ways to use @ symbols to, like, build animations separate from the models, but I haven’t done that myself. When using files with animations built in, it’s pretty straightforward to pick an animation using strings or actual clips assigned in the inspector.

Thanks for this answer, I hope I can understand maya fast better and make animations.

I know now where to start and how to do it, thanks :smiley: