Character with spear

I have a character whom I want to carry a spear, and to animate attacking/defending with the spear, for export to Unity. I’m looking for advice on the best approach. Is it best to have the spear as part of the character mesh, so there is only one object? or to have it as a separate object? If the latter how does that export to Unity? My experience with animation is small so I’m still learning the basics. I guess the character will always be carrying this spear so no need to have it suddenly appear from some inventory. Also I’m using third person perspective.

Update - I created a spear as a separate object, parented it to the hand bone in the idle animation, and exported it to fbx. In Unity the idle animation plays (character sways side to side, the spear also sways but it is not in the right place. It is basically located where the players hand is in T pose, not where the hand is in the animation. I had it in the right location in Blender, so not sure what I need to do to ensure that it stays in the right place in Unity.

Further update - works correctly as a Legacy Rig, just not with Mecanim. Guess I’ll stay with the Legacy Rig

A while back I asked about Mecanim and was pretty much told that it’s mainly for Mo-cap Which I assume mans motion capture. Now as for your question I’m about to try this myself probably next week and the way I was already thinking of some ways to try and get it to work and look good at the same time. Rather than do a big list of ideas tell me is your character always gonna be carrying the spear or will it switch weapon? Also do you plan on the spear always being visible or will it only come out when you attack or block much like older games?

My current solution is to have the character always carrying the spear, which is now part of the one player object. For the animation is has a separate bone, which can be manipulated to create the different stances. I export to Unity as a Legacy Rig rather than a Humanoid rig for Mecanim. I have to move the character with the Transform rather than using the root motion of the animations.

I’m wondering if I can change the spear (maybe different models) in Unity by changing the mesh property of the renderer. That way the player can select different spears but they’ll all work the same. I’ll be trying that out shortly.

I don’t know too much about how Unity works and how what you do in blender transfers over,
But i know that you can create a “Child of” constraint on the spear and set it to be a child of the Armature, and the bone to be the hand that is holding it. (then i think it will move out of place and you can click set inverse or something along those lines and it pops back into place)

This makes it so that the spear will follow the hand no matter where it moves even as a separate object, and can also be animated itself if needed. So say that he is holding the very end of the spear with the spear upwards and he lets go of it for a moment. You can animate it falling down until he catches it with his hand near the blade of the spear.

If he were to drop it, you can animate the influence bar of the constraint so that when it falls out of his hand you could add a key frame for 100% influence and then 0% the next frame to that it can move freely without following the movements of the character’s hand.

But like i mentioned, i don’t know if this could correlate over to Unity so this might not be too helpful d:

Sorry, Hope it helps (: