LoadAnimSeq

BlitzMax Forums/MiniB3D Module/LoadAnimSeq

siread(Posted 2009) [#1]
This doesn't seem to be working for me. I tried the following code in Blitz3D without a problem, but when porting to miniB3D I can't switch between anims...

Graphics3D 640,480,0,2
	
mesh = LoadAnimMesh("1.b3d")
LoadAnimSeq(mesh,"2.b3d")
LoadAnimSeq(mesh,"3.b3d")
LoadAnimSeq(mesh,"4.b3d")
LoadAnimSeq(mesh,"5.b3d")
LoadAnimSeq(mesh,"6.b3d")
LoadAnimSeq(mesh,"7.b3d")
LoadAnimSeq(mesh,"8.b3d")

EntityFX mesh,1
PositionEntity mesh,-15,-15,0
Animate mesh,1,0.5

pivot=CreatePivot()
cam=CreateCamera(pivot)
PositionEntity cam,0,100,-400

lit=CreateLight()
RotateEntity lit,45,45,0

trans=10

While Not KeyHit(KEY_ESCAPE)

	If KeyHit(KEY_SPACE) Then trans=10-trans

	If KeyHit(KEY_1) Animate mesh,1,.5,0,trans
	If KeyHit(KEY_2) Animate mesh,1,.5,1,trans
	If KeyHit(KEY_3) Animate mesh,1,.5,2,trans
	If KeyHit(KEY_4) Animate mesh,1,.5,3,trans
	If KeyHit(KEY_5) Animate mesh,1,.5,4,trans
	If KeyHit(KEY_6) Animate mesh,1,.5,5,trans
	If KeyHit(KEY_7) Animate mesh,1,.5,6,trans
	If KeyHit(KEY_8) Animate mesh,1,.5,7,trans
	
	If KeyDown(KEY_A) MoveEntity cam,0,0,10
	If KeyDown(KEY_Z) MoveEntity cam,0,0,-10
	
	If KeyDown(KEY_LEFT) TurnEntity pivot,0,3,0
	If KeyDown(KEY_RIGHT) TurnEntity pivot,0,-3,0

	UpdateWorld
	RenderWorld
	
	Text 0,10,"Anim seq: "+AnimSeq( mesh )
	Text 0,30,"Anim len: "+AnimLength( mesh )
	Text 0,50,"Anim time:"+AnimTime( mesh )	
	Text 0,70,"Transition time (Space)="+trans
	Text 0,90,"A/Z: Zoom"
	Text 0,110,"Left/Right: Rotate Cam"
	Text 0,130,"1-9: Change anim"

	Flip
	
Wend

End


When I change animation my model gets distorted, then if I change again it crashes. Does LoadAnimSeq work differently in miniB3D?


Romanski(Posted 2010) [#2]
I have the same problems with my animated mesh. did you find any way to fix it?


siread(Posted 2010) [#3]
I think i did mesh.LoadAnimSeq().


Kryzon(Posted 2010) [#4]
You mean, by directly calling the Method instead of the "procedural interface"?


SLotman(Posted 2010) [#5]
Try using SuperStrict, and declaring "mesh" as TMesh. Don't know if it will solve this particular problem, but it solves a lot of issues.

LoadAnimMesh returns a TMesh, but since you didn't declare "mesh" it's created as an Int. Then, on LoadAnimSeq, you're passing an Int instead of a TMesh... I don't know how BMax handles it internally, but I can see this could be the cause to a lot of problems!


Kryzon(Posted 2010) [#6]
That makes total sense.


Leon Drake(Posted 2015) [#7]
Where is the version of minib3d that supports this, all the downloads i find it's under todo


Leon Drake(Posted 2015) [#8]
nvm it was in TEntity


ErikT(Posted 2015) [#9]
LoadAnimSeq is in the latest release and maybe earlier ones too (haven't checked), the docs say it's not in yet but it works fine for me.


Leon Drake(Posted 2015) [#10]
i notice there is a hiccup in a few animations like the first frame of the next animation made it way into the keyframes of the previous animation. i'm going to have to look into this and see what is happening.


angros47(Posted 2015) [#11]
Strangely, LoadAnimSeq is not available in iminib3d; also, in minib3d it is available, but it only works if called as a method (in "functions.bmx" there is the routine, but it's empty).

I had missed it, thanks to ErikT for bringing it to my attention; it will be included in the next version of OpenB3D.