loadanimseq and b3dpipeline

Blitz3D Forums/Blitz3D Programming/loadanimseq and b3dpipeline

vivaigiochi(Posted 2010) [#1]
look this code please (don't consider the parameters)

Function CreateEnemy.Enemy(filetex$,mesh$,x,y,speed)
this.enemy=New Enemy
;Stop
this\model=LoadAnimMesh("media/topocammina.b3d")
topo=this\model
ScaleEntity topo,0.2,0.2,0.2
boxtopo=FindChild(topo,"Box01")
bracciodx=FindChild(topo,"bracciodx")
bracciosx=FindChild(topo,"bracciosx")
gambadx=FindChild(topo,"gambadx")
gambasx=FindChild(topo,"gambasx")
coda=FindChild(topo,"coda")

k=LoadAnimSeq(topo,"media/topocammina.b3d")


boxtopo=FindChild(topo,"Box01")
Animate topo,1,0.2,1
Animate boxtopo,1,0.2,1
Animate bracciodx,1,0.2,1
Animate bracciosx,1,0.2,1
Animate gambadx,1,0.2,1
Animate gambasx,1,0.2,1
Animate coda,1,0.2,1
this\dir=1
this\state=0

;PositionEntity topo,x1,y1,z1


EntityType this\model,TYPE_ENEMY
EntityRadius this\model,10,10
ResetEntity this\model
FreeImage(temp)
Return this
End Function

b3d models used in this example works fine if used it in single.
obviously are the same model (bones and mesh) but why second animation don't work after loadanimseq.
hovewer what are the correct exportation mode into b3d pipeline because i have just tried several combination like only bones without mesh adn so on...

Last edited 2010


_PJ_(Posted 2010) [#2]
Try changing your 'Animate' command.

I'm just guessing here, and I have limited experience with Animated Meshes, but on first Loading the Mesh, it would get an animation sequence by default (presumably as sequence 1 (or maybe sequence 0 unless 0 is used for errors only)
So when you LoadAnimSeq, you are adding a sequence, not overwriting the original.
Use the value 'k' that was returned for your Animate commands:
Animate topo,1,0.2,k
Animate boxtopo,1,0.2,k
Animate bracciodx,1,0.2,k
Animate bracciosx,1,0.2,k
Animate gambadx,1,0.2,k
Animate gambasx,1,0.2,k
Animate coda,1,0.2,k


Lastly, I'm pretty sure you wont need to use FindChild() again for the second series of animations, since the handles are defined already :)


SLotman(Posted 2010) [#3]
Also, you don't need to load the same B3D twice - just use ExtractAnimSeq to get the animation from the already loaded B3D file.


vivaigiochi(Posted 2010) [#4]
ok i know all of this, second load and findchild calls are not needed.
i have use the value returned from extractanimseq but nothing.


_PJ_(Posted 2010) [#5]
I don't know how animations are storerd on meshes, but are you certain that it exists?

What does 'k' return? (If it'#s a handle, maybe it's not possible to tell if it's valid or not...? :S)

I'm just trying to think of ways in which to test 'where' the program may be going "wrong..."


Sake906(Posted 2010) [#6]
Ahhh... this problem.

I have had to deal a lot with how things work with b3d files and their animation sequences.

The key is to have your main mesh, with the "skin" modifier storing the bones and such, exported -without- having the bones selected (object wise) before exporting (to make sure, hide everything else in your scene so the exporter just exports that); the pipeline will automatically keep the bone nodes within the b3d file if you enable "Export Bones". Also, do not export animations for this main mesh.

Then you export each animation sequence individually by selecting the mesh with the "skin" modifier alone and exporting it, enable both "Export Bones" and "Export Animations". You may want to disable "Export Mesh" since that's not really needed for the sequences and will reduce file size.

"Scene Root" should be disabled on both the main mesh and the animation sequences.

In blitz3D, load the main mesh first and then load the different sequences, it should work.


SLotman(Posted 2010) [#7]
I never had to do it that way. I just export the mesh, with bones and all, and then use extractanimseq to generate the animations I want.

Of course, I need to do a mesh=GetChild(animated_mesh,1) to get the actual mesh instead of the "Scene Root". Other than that - it all works perfectly.