Now I know this question has been asked 2 times before here on unity answers, but I searched the web for at least 48h the past month. I tried, retried and retried and found nothing but confusing infos.
I am creating an fps with unity pro and I recently finished the hud as well as the main menu and the various options and settings. I am now working on the player character, and I wanted to do a full body palyer model like in mirror’s edge, where you can see your whole body. I simply don’t like it when you can’t see your body in fps games.
But, what would be the best method now to apporach this in unity? I have NO idea on how to parent the camera correctly to the head, let alone how to parent the weapons to the hand and synch the animations of body & weapon (a reload for instance) :S
If you are using Unity 4, then mecanim will really help with blending different animations together such as walking and shooting/reloading etc. at the same time. Check out how to use mecanim avatar body masks to get a better idea.
Other than that it’s really just the same as how you’d do it for a third person game. You have your player character model which plays different animations based on input etc.
As far as parenting goes, you can try parenting to the bones of the character directly (as bones nicely show up as invisible gameobjects in unity).
For our fps game, we parented the camera to the head bone of the character model. But make sure your animations don’t move the head too much because it can get a bit disorienting if the head bobs too much when walking for example. A good advice also would be to have the actual head of the character be a separate element than the rest of the body (it can be part of the same model file like fbx or obj etc, just make sure it shows up as an individual child gameobject in unity). That way, you can set the layer property of the head and have the camera not show that particular layer so you don’t “go through” the head model.
As for weapons, you can parent them similarly to the hand bones. A good trick which worked for us was that we attached all the different kinds of weapons the player can pick up (each game objects themselves imported separately) to the right hand bone of the character and just set the current one active. That way we could quickly check if the weapons fit the hands properly and had different animations (like reloading etc.) based on the size of the weapon.
Anyways, that’s my two cents on this. Hope it’s useful and best of luck!