So I'm animating my character in max and importing to unity. Now I'd like to be able to switch weapons within the code in game and was wondering how I'd go about doing it so that the weapon moves with the animations.
Thoughts.. 1. Attach the weapon to a bone in the skeleton from max. This is a bone just for one handed weapon angles and movements. But this would need the weapon to be part of that bone 100% within unity not sure if I can do that.
Help would be appreciated, I'm not a programmer and this is all very new to me. I think I've been doing pretty well though.
asked Mar 14 '10 at 02:58 PM
In Unity, all bones are just Transforms, so you can attach child objects to any particular bone just as easily as parenting an object to a normal gameObject. This can be done in the editor, or via scripting.
For more information in general about using animated characters in Unity, read this manual page:
To parent an object to another at runtime using script, it's simply a matter of assigning the transform.parent property to some other object's transform. In your case you'd want to set the weapon object's transform.parent to the hand bone's transform.
answered Mar 14 '10 at 08:18 PM