The code below grabs a preloaded animated mesh(b3d), and then copies it to pModel\ObjectHandle... The problem is, the animation sequences don't seem to copy over.. I tried to reextract the animation sequences from the copy, but when I run the program, I get a 'can't find animation sequences' error.. The original template model has the sequences and runs fine.. Is there something I'm missing, or do I have to specifically load a copy of every single game piece over and over since it's animated?
Function PopulateBoard()
; create player pawns
tmpmod.ModelTemplate = FindPiece("Militia")
row = 5
For col = -7 To 7 Step 2
Pmodel.ModelTemplate = New ModelTemplate
pModel = tmpmod
PModel\ObjectHandle = CopyMesh(tmpmod\ObjectHandle)
;Scale Model
pmodelwidth# = MeshWidth(pModel\ObjectHandle)
pmodelheight# = MeshHeight(pModel\ObjectHandle)
pmodeldepth# = MeshDepth(pModel\ObjectHandle)
; Scales Entity to height of 2.0
;Stop
ScaleEntity pModel\ObjectHandle, (1.0/pmodelheight#) * pModel\size#, (1.0/pmodelheight#) * pModel\size#, (1.0/pmodelheight#) * pModel\size#
PModel\name$ = PModel\name$ + col
; Extract Animation Sequences
For extract = 0 To pModel\TotalAnims - 1
ExtractAnimSeq(pModel\ObjectHandle, pModel\Anim[extract]\Start, pModel\Anim[extract]\Finish)
Next
Animate pmodel\objecthandle, 2, 0.2, 3, 20
ShowEntity PModel\ObjectHandle
PositionEntity PModel\ObjectHandle, row, .5, col
Next
End Function
|