Blitz3D Animation and Control Part 1


Tweet blitz3d 3d-animation-tools tutorials
(Posted 8 months ago) RonTek

Basic Blitz3D animation handling and controls

derived from LoadAnimesh Blitz Docs example.

animated model by eqanox16

http://s000.tinyupload.com/?file_id=28839619003162540513

Graphics3D 640,480,0,2
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 
man=LoadAnimMesh("combo2.b3d") 
ScaleEntity man,.5,.5,.5

idle = ExtractAnimSeq(man, 5,100)
jumping = ExtractAnimSeq(man, 145, 198)
running = ExtractAnimSeq(man, 106, 140)

; Animate mesh - this will begin an animation sequence which is updated when UpdateWorld is called 
Animate man,1,.5,idle,10.0 ; let's do a looping idle animation = 1, smooth transition = 10.0

While Not KeyDown(1) 

If Not Animating(man) Then Animate man,1,.5,idle,10.0

If KeyHit(17)  ; Press W
    Animate man,3,.5, running,10.0 ; running plays one shot = 3
Else If KeyHit(57) ; Press Space
    Animate man,3,.5, jumping,10.0 ; jumping plays one shot = 3
End If

UpdateWorld ; Update anim - without this our anim mesh will freeze 
RenderWorld ; Render everything 
Flip ; Show everything 

Wend 

End 

Reply To Topic (minimum 10 characters)

Please log in to reply