Object animation not loading

Blitz3D Forums/Blitz3D Programming/Object animation not loading

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


maybe you can try this:

snowman = LoadanimMesh("snowman_anim.x")

to animate it, just use:

animate snowman,1,1

Had this same problem, svenarts got it right.

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?

I think it is caused by the Animate command. It should be called before the main loop.

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.