B3D Animation ?

Blitz3D Forums/Blitz3D Programming/B3D Animation ?

IPete2(Posted 2007) [#1]
Hiya,

I'm having some characters done in 3DS Max (version8.0), and we are using the fab exporter "B3D Pipeline".

We are using 3DS Max

Mesh
Bones
Skin modifier
Animate
B3D Export

We can see the animation in the B3D viewer just fine. In B3D using loadanimmesh the animation does not work straight off, ie. loadanimmesh, animate mesh,1,1,1,1 does not work. BUT if I then load the animated exported mesh into UUnwrap 3D and then Milkshape and export it, it works fine!!!

I don't want to have to pass everything through UUnwrap 3D and Milkshape if I can avoid it... am I setting the export properties incorrectly on Pipeline?

In essence, in code, why do I have to do all this:
Global playc=LoadAnimMesh("anim.b3d")

If CountChildren(playc) > 0 Then 
	For childcount = 1 To CountChildren(playc) 
		player = GetChild(playc,childcount)
	Next 
EndIf

ExtractAnimSeq(playc ,0,69) ;anim sequence 1 

Animate playc,1,1,1,1



When wat I really want to do is this...

Global playc=LoadAnimMesh("anim.b3d")
Animate playc,1,1,1,1


The strange thing is I dont have to look for other bones in other models such as psionics dwarf, zombie etc, why do I need to do that in this case?

Thanks,

IPete2.

(edit - thanks for moving this here!)


Hujiklo(Posted 2007) [#2]
It sounds like you just haven't found the correct child object to animate. Try finding the child with the exact entityname() (as it is named in the 3dsmax) and animate that...probably a null node or extra bone like a sword or something throwing it out of squiff.


IPete2(Posted 2007) [#3]
Hujiklo,

Thanks I shall try looking for that and report back.

IPete2.


Hujiklo(Posted 2007) [#4]
Oh - I just noticed you're not even animating the child you extracted in the code above. I think you want to animate ' Player' not 'playc'...and you may even have to extract the animsequence from the 'child' not the 'rootnode' I can't quite remember.


Mattizzle(Posted 2007) [#5]
I don't even understand what that whole code block was meant to do anyways. After it, you'll just end up having 'player' = the last child of 'playc'. And if that's what you want then why not do:
[code]
player = GetChild(playc,CountChildren(playc))
[/codebox]

Please correct me if I'm wrong. Though, about your main question here I have no idea, but it sounds like Hujiklo is right.


IPete2(Posted 2007) [#6]
Mattizzle,

I am not explaining myself too well here - normally I use a loadanimmesh("mesh.b3d") and then simply use the animate entity command to get the entity animating.

but...

I am starting to work with a (brilliant) animator (using 3DS Max and B3D Pipeline) and the method stated above does not animate the mesh when loaded into B3D. So I read up on why it might not work, and it seems that finding the root bone and animating that instead may be the solution, but I can't figure out how to do it.

Now...if I take what my animator exports as a b£D mesh with animations galore and pass it thorugh UU3D and then import and export from Milkshape, it works with the code above - normally!!??? What I want is to be able to loadanimmesh and animate the character straight away, which is evidently possible as it works exported from Milkshape. Either way I want to (a)understand how to find the root bone and animate the mesh in (preferrably simple) code OR (b) set the export settings for B3D Pipeline differently if we currently have them wrong so the exported animated mesh works straight off!

IPete2.


Dreamora(Posted 2007) [#7]
Give the rootbone some usefull name and use findchild, should make it quite easy to get it working.

But your brilliant animator might need to make sure he / she does not use more than 4 vertex weights.


REJLA(Posted 2007) [#8]
I had a similar problem in the game i'm creating.
I found the answer in the forums


load the b3d file
find the child with the same name as the name of the mesh you had in Max and animate that child

The code bellow is an example of how it works

player=LoadAnimMesh("player.b3d")
playeranim=FindChild(player,"Box01")
Animate playeranim


the Box01 child is the name that the mesh had in Max


IPete2(Posted 2007) [#9]
@Reja,

You have obviously suffered exactly the same issue, as you said. That works beautifully thanks for that!

@Dreamora,

Yeah I had given it an easy name, or so I thought, I was trying to move the wrong thing, Reja sorted me out with that handy snippet.

Looking at the file inside UU3D I can see there are 6 weights, do I need him to use less? Any information at this early stage would be greatfully received as we are just about to get into proper animation sequences tomorrow.

IPete2.


(tu) sinu(Posted 2007) [#10]
Each vertex is only allowed 4 bones max attached to it.


jfk EO-11110(Posted 2007) [#11]
As Dreamora said don't use more than 4 weights. Tho from what I know I'd say don't use more than 2 whenever possible cause they will slow down the game a lot.

I'd also suggest to make sure to export the animation in a way that doesn't require to search for certain children to animate it. This will simplify loading of dynamic content.
To me it sounds like a bug in the exporter, as if it's adding a dummy top node. Animated meshes already have this dummy node, created by blitz when loading (note: EntityClass$ of the top parent is not "Mesh").


Pudding(Posted 2007) [#12]
The best way to export a single character, is to hide everything but a single skinned mesh, and uncheck Scene Root when you export. Then you won't have to use FindChild, and loading animation sequences etc. will work as expected.

Sometimes the exporter has to add a Scene Root node to ensure that the exported file has a single root node. This lets you export a scene with multiple skinned meshes etc. in a single file - but you then have to animate the children manually, and loading animation sequences will be harder...

It's a feature, not a bug ;)

-Pudding


Mattizzle(Posted 2007) [#13]
Cool! Pudding, I think your pipeline program is becoming very popular! I think I'll try it out too!