Animation: How does it work?
Blitz3D Forums/Blitz3D Programming/Animation: How does it work?
| ||
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. |
| ||
Check out extractanimseq Set the first and last frames, give it a seq number, then animate you mesh with the sequence you gave it. |
| ||
I usually do it manually. SetAnimTime(AnimTime + 1) or whatever the command is. |
| ||
If what Rob suggests doesn't work, post some code of your problem :o) |
| ||
Cheers I'll try those suggestions. I have no code. Animate mesh,1,1,1 is as far as I've got. |
| ||
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. |
| ||
This doesn't work: SetAnimTime this\u_Mesh,1+(game_clock/4) And 3 (which should cycle frames 1-4) |
| ||
This doesn't work: Animate this\u_mesh,1,1,0 I'm going to try the extractanimseq suggestion now. |
| ||
Hmmm... like I usually grab the animation time for the mesh and just increment it in the function. |
| ||
No joy with extract animseq. |
| ||
Tried this (no joy): time=AnimTime (this\u_mesh) SetAnimTime (this\u_mesh,time+1) |
| ||
Hmmmph ... what did you export it with? Are you using the Pipeline extensions? |
| ||
Can you post the exact code your using? I'll fit in an animated model i have and see if it works :) |
| ||
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). |
| ||
Oh you have got an updateworld in there haven't you? |
| ||
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? |
| ||
Yes I have updateworld (mentioned in the first post) I tried animated entity but that does nothing. The model is exported from MAX. |
| ||
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. |
| ||
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. |
| ||
Not sure about Pipeline. I'll ask my brother. |
| ||
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. |
| ||
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 :) |
| ||
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. |