Object animation not loading

Blitz3D Forums/Blitz3D Programming/Object animation not loading

SkyCube(Posted 2006) [#1]
Hello all,

I have a .x object with a simple animation, but when I load it in Blitz, I get an error message saying Entity has no animation attached! Does anyone know how I can load the animation within the object? Here's my code:

AppTitle "Object Animation Test"

Graphics3D 800,600
SetBuffer BackBuffer()

cam = CreateCamera()
PositionEntity cam,0,1,0


;create a background
bg = LoadImage("level1_sky.jpg")

CameraClsMode cam,False,True
p = CreatePlane()
PositionEntity p,0,0,0
pt = LoadTexture("Materi1.jpg")
EntityTexture p,pt

snowman = LoadMesh("snowman_anim.x")
PositionEntity snowman, 0,1,0

DrawImage bg,0,0
UpdateWorld
RenderWorld
Flip

While Not KeyDown (1)

;load animation from file
Text 0,0,Str(LoadAnimSeq(snowman,"snowman_anim.x"))
Flip
WaitKey 
End
Animate snowman,1
If KeyDown(200) ;up
  MoveEntity cam,0,0,1
End If


If KeyDown(203) ;left
  TurnEntity cam,0,1,0
End If

If KeyDown(208) ;down
  MoveEntity cam,0,0,-1
End If

If KeyDown(205) ;right
  TurnEntity cam,0,-1,0
End If




DrawImage bg,0,0
UpdateWorld 
RenderWorld
Flip

Wend
End



Svenart(Posted 2006) [#2]
maybe you can try this:

snowman = LoadanimMesh("snowman_anim.x")

to animate it, just use:

animate snowman,1,1


Terry B.(Posted 2006) [#3]
Had this same problem, svenarts got it right.


SkyCube(Posted 2006) [#4]
You're right... I no longer get the error saying there is no animation attached. However, my mesh still isn't moving. Perhaps the problem is in my .x file. I heard something about DX9 not being compatible with Blitz... could that be the problem?


b32(Posted 2006) [#5]
I think it is caused by the Animate command. It should be called before the main loop.


Barliesque(Posted 2006) [#6]
You're reloading the animation sequence EVERY FRAME! Get that LoadAnimSeq() outside the while loop. ...Properly indenting your code can help you to spot things like that MUCH more easily.