I converted the LoadAnimMesh example and tested it on a .b3d animated mesh. It needs a .b3d file, and a 'subobject' needs to be defined. It works, but it might need some adjustments to fit your model.
; LoadAnimMesh Example
; --------------------
; In this example we will demonstrate the use of the LoadAnimMesh command.
; Quite simply, we will load an anim mesh from file, animate it, and then view it.
Graphics3D 640,480
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,20,-100 ; position camera so that robot will be in view when loaded
light=CreateLight()
RotateEntity light,90,0,0
; Load anim mesh
robot=pLoadAnimMesh("file.b3d")
;animate object
Animate robot, 1
;determine animation length
length = AnimLength(robot)
;this is the subobject that will be animated
sub = GetChild(robot, 1)
;loop through animation
For i = 1 To length
;set animation time
SetAnimTime robot, i
;set animation keys
iSetAnimKey robot, i
Next
;add sequence to subobject
AddAnimSeq sub, length
;stop animation for original object
Animate robot, 0
;test animation for subobject
Animate sub, 1, 1, 0
;main loop
While Not KeyDown(1)
UpdateWorld ; Update anim - without this our anim mesh will freeze
RenderWorld ; Render everything
Flip ; Show everything
Wend
End
;recursive setanimkey
Function iSetAnimkey(mesh, key#)
SetAnimKey(mesh, key)
For i = 1 To CountChildren(mesh)
iSetAnimKey(GetChild(mesh, i), key)
Next
End Function
;protected loadanimmesh
Function pLoadAnimMesh(f$)
If FileType(f$) <> 1 Then RuntimeError "file '" + f$ + "' not found"
Return LoadAnimMesh(f$)
End Function