Attaching a sword to a character

Blitz3D Forums/Blitz3D Programming/Attaching a sword to a character

Lilprog(Posted 2003) [#1]
Im working on a game that the main character is animated with md2 animation files(made in milkshape so could be translated to b3d. Instead of making new animations for the character to have him with or without a sword, or with different swords, I was wondering if it is possible to create animations without the sword, then attach the sword to the model in the game?

Anyone else done this or have a better way to do it?

Rob Gardner
GardnerGaming


poopla(Posted 2003) [#2]
Sure, youll need to have a child object in the mesh that you can find in blitz. Then with parenting, attach the sword to the child. Im doing the same thing to attach scopes, silencers, grenade launchers etc in plasma's weapon system. MD2 will work the same way as .B3d or .3DS in this regard.. I think. :). G'luck.


jhocking(Posted 2003) [#3]
Md2 won't work that way because there are no separate child objects to attach the weapon to. You should probably use a b3d file (Milkshape can export to b3d file format.) Use FindChild with the name of the hand bone (assigned in Milkshape) to assign a handle to that bone and then parent the sword to the hand bone.


Ricky Smith(Posted 2003) [#4]
If you export an animated md2 to b3d surely you would end up with a mesh with no animation info - so you would have to create a skeleton - bind this to your mesh and re-do all the animation using the bones.


jhocking(Posted 2003) [#5]
When he said "made in milkshape" I assumed that meant he has the original Milkshape animations and can export those to either md2 or b3d file format (in which case I recommend the latter.)


Ricky Smith(Posted 2003) [#6]
Is Milkshape that clever ?
Can you create a hierarchial type animation sequence used by the md2 model format and then simply export as a boned .b3d animated mesh ?
Does it create the bones during the export process ?
Could you then by the same token export a boned skeletally animated model as an md2 with all the anim info ?
Will the export process create all the Morph Targets ?
My guess is that you would lose all animation info in the process.


jhocking(Posted 2003) [#7]
md2 does not support hierarchical animation. As for losing the animation info when exporting a skeletal animated model, that's a pretty odd conclusion because b3d supports skeletal animation. Before exporting there is nothing "md2" about the animation (eg. no morph targets;) obviously, an animated model saved in Milkshape file format can be exported to any file format Milkshape supports.

EDIT: Rereading your questions it sounds a little like you misunderstand how md2 models are created. Yes, exporting to md2 automatically generates the morph target/frames. It doesn't matter which file format you intend to export to (between md2 and b3d anyway,) the animation is created in exactly the same way. Milkshape does not support morphing animation, only skeletal animation, and anyway other tools like 3D Studio Max can also export a Character Studio (ie. skeletal animated) model directly to md2. Once upon a time you had to use the Snapshot tool first to "bake" the animation frames but even then the original animation was done with bones and converted just before export. You will of course lose the bones info during such a conversion and that is why I'm recommending using b3d file format instead.


Ricky Smith(Posted 2003) [#8]
Thanks for clarifying - I didn't realise that you could export skeletal animation as an animated md2 .
Of course if the original animation was skeletal then it makes sense to export as .b3d. Can't see why you would export to any other format if you're using Blitz.