Loading AnimMeshes

Blitz3D Forums/Blitz3D Programming/Loading AnimMeshes

_PJ_(Posted 2005) [#1]
If I load in an Animated mesh, say of a person. The animation makes the person shoot a gun, only the model doesn't posess a gun.

This way, I hope to be able to 'parent' different gun meshes to the hand of the animated mesh as required.

Will Blitz3D animations 'know' that the gun should move with the hand, or will it just remain parented to the centre-handle-point of the mesh itself? If necessary, how can I specify the gun to move with the animation?


Rob Farley(Posted 2005) [#2]
Stick a bone on the end of the hand call it "gun" or something, gunlocation = findchild "gun" and position the actual gun at the entityx(gunlocation,true), entityy(gunlocation,true), entityz(gunlocation,true) and rotated entitypitch(gunlocation,true), entityyaw(gunlocation,true) and entiyroll(gunlocation,true).

Job done.


_PJ_(Posted 2005) [#3]
Stick a bone on?

What IS a bone, like a pivot?

and how do I 'stick one on'? Especially if I could just 'stick stuff on' I would stick my gun direct to the end of the hand.


Rob Farley(Posted 2005) [#4]
Models have bones for the animation, the bones are what make the various verts move around to create the animation.

Load your model into a modeller... add another bone... save.


_PJ_(Posted 2005) [#5]
Hehe thanks, Rob!


Rob Farley(Posted 2005) [#6]
Forgot to mention...

Load your model into a modeller... add another bone... put it in the right place and attached to the right bone... save.


RiverRatt(Posted 2005) [#7]
How do you call or refer to that bone in blitz?


scribbla(Posted 2005) [#8]
or you could use a bone already in the hand if its got one there just getchild()
parent the weapon to a bone in the hand using findchild() or getchild()

i think its something like
1: grab the bone in the hand, you will need to know its name

handbone=getchild(entity$,bonename$)

2: parent the weapon to handbone

EntityParent weapon,handbone


Barliesque(Posted 2005) [#9]
By parenting a pivot to the hand, you end up having to control the gun's aim programatically, or have it absolutely glued to the hand.

Better to use a bone in the original animations. You can then animate the gun independently, e.g. The character spins the gun once on his index finger, before taking aim.