Animation: How does it work?

Blitz3D Forums/Blitz3D Programming/Animation: How does it work?

John Pickford(Posted 2004) [#1]
My brother has built and rigged a skinned model in MAX. He's created keys for a simple run cycle. The model has been exported as B3D.

I can load it in with LoadAnimMesh and the model displays fine but how do I get it to animate?

The Animate command requires a 'sequence' parameter (alright it's opional). I've tried Animate mesh,1,1,1 (and various random variations). The keys are set up so 0 is the basic stance and 1-4 form a simple run cycle. Nothing I've tried seems to display anything but the model in it's initial stance.

I have updateworld() in my main loop.

I'm stumped. The docs don't seem to explain anything.


Rob Farley(Posted 2004) [#2]
Check out extractanimseq

Set the first and last frames, give it a seq number, then animate you mesh with the sequence you gave it.


Jeremy Alessi(Posted 2004) [#3]
I usually do it manually. SetAnimTime(AnimTime + 1) or whatever the command is.


Ross C(Posted 2004) [#4]
If what Rob suggests doesn't work, post some code of your problem :o)


John Pickford(Posted 2004) [#5]
Cheers I'll try those suggestions. I have no code. Animate mesh,1,1,1 is as far as I've got.


Ross C(Posted 2004) [#6]
Try

Animate mesh,1,1,0

0 for sequence plays ever frame of animation. If that doesn't work, maybe it didn't export correctly.


John Pickford(Posted 2004) [#7]
This doesn't work:

SetAnimTime this\u_Mesh,1+(game_clock/4) And 3

(which should cycle frames 1-4)


John Pickford(Posted 2004) [#8]
This doesn't work:

Animate this\u_mesh,1,1,0

I'm going to try the extractanimseq suggestion now.


Jeremy Alessi(Posted 2004) [#9]
Hmmm... like I usually grab the animation time for the mesh and just increment it in the function.


John Pickford(Posted 2004) [#10]
No joy with extract animseq.


John Pickford(Posted 2004) [#11]
Tried this (no joy):

time=AnimTime (this\u_mesh)
SetAnimTime (this\u_mesh,time+1)


Jeremy Alessi(Posted 2004) [#12]
Hmmmph ... what did you export it with? Are you using the Pipeline extensions?


Ross C(Posted 2004) [#13]
Can you post the exact code your using? I'll fit in an animated model i have and see if it works :)


John Pickford(Posted 2004) [#14]
Well I can't post my entire game. I've posted all the code I've tried. It's only one or two commands.

The code is definitely being called, once per loop (40fps).


Rob Farley(Posted 2004) [#15]
Oh you have got an updateworld in there haven't you?


Jeremy Alessi(Posted 2004) [#16]
When you load the entity at first just use

Animate(entity,1) ... that doesn't do anything? Also ... what about the extensions ... where are you exporting this from?


John Pickford(Posted 2004) [#17]
Yes I have updateworld (mentioned in the first post)

I tried animated entity but that does nothing. The model is exported from MAX.


Big&(Posted 2004) [#18]
You have to use FindChild.

If in Max the models skin is called "skin":

Bloke=LoadAnimMesh("bloke.b3d")
BlokeAnim=FindChild(Bloke,"skin")
Animate BlokeAnim,1,1,1

Its cause the Max exporter puts a Root node at the top of the hierarchy and the skin is below that.

As a side note, if you are using Character Studio and a Physique skin, it will have to be converted to a normal Max skin but you can get a free Max plugin for that.

Hope this helps.


Jeremy Alessi(Posted 2004) [#19]
Using Pipeline then right? Are you calling:

extModel.EXT_Entity = New EXT_Entity
extModel.EXT_Entity = EXT_LoadEntity()EXT_InitEntity.EXT_Entity(extModel\root)
EXT_UpdateEntity(extModel.EXT_Entity)

timer_anim_frame = AnimTime(extModel\root) + 1
SetAnimTime(extModel\root,timer_anim_frame )
EXT_UpdateEntity(extModel.EXT_Entity)

Not sure if this really matters but I remembered having some animation problems with Pipeline ... can't remember the specifics.


John Pickford(Posted 2004) [#20]
Not sure about Pipeline. I'll ask my brother.


John Pickford(Posted 2004) [#21]
FindChild did the trick!! Cheers Big&

And thanks to everyone else for your suggestions. I've a much clearer understanding of what's going on now.


Big&(Posted 2004) [#22]
No probs.

Just another point.

If you have anything attatched to the skeleton under the skin (like a sword or a gun) you will have to do a "Animate Bloke,1,1,1" as well (or what ever speed the skin is animating at).

All good fun :)


Rob(Posted 2004) [#23]
This is because of the hierarchy. It happens on export sometimes. You can use this trick to animate just a few bones.

Other tricks: animating a skeleton, then grabbing the bone rotation values and applying to a boned mesh. You can blend anims this way for example character walks and looks around.