MD2Animating ( md2 )
Parameters
| md2 - md2 entity handle |
Description
|
Returns True while an md2 model is animating, False when it is not. The natural use is waiting for a one-shot move to finish: play an attack or a death with mode 3, then watch for MD2Animating to go False before letting the character do anything else. Looping and ping-pong playback never stop on their own, so the result stays True until you call AnimateMD2 with mode 0. This is the md2 counterpart to Animating, and the two are not interchangeable - each only understands its own kind of model. See also: AnimateMD2, MD2AnimTime, MD2AnimLength, LoadMD2, Animating. |
Example
; MD2Animating Example ; -------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,45,45,0 ; Load the md2 model and apply its texture gargoyle=LoadMD2("media/Gargoyle/Gargoyle.md2") garg_tex=LoadTexture("media/Gargoyle/Gargoyle.bmp") EntityTexture gargoyle,garg_tex ; Face the gargoyle towards the camera PositionEntity gargoyle,0,-45,100 RotateEntity gargoyle,0,180,0 ; Loop the wing-flap frames 32-46 AnimateMD2 gargoyle,1,0.1,32,46 playing=True While Not KeyDown(1) ; Space stops and restarts the md2 animation If KeyHit(57) playing=1-playing AnimateMD2 gargoyle,playing,0.1,32,46 EndIf UpdateWorld ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,1 If KeyDown(208) Then MoveEntity camera,0,0,-1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Space: stop/start animation Arrows: camera Esc: exit" ; MD2Animating returns 1 while the md2 is animating, 0 when stopped Text 0,20,"MD2Animating(gargoyle) = "+MD2Animating(gargoyle) Flip Wend End
Index