Dogfights Camera Shake

Blitz3D Forums/Blitz3D Programming/Dogfights Camera Shake

Here is my solution: (How to implantate this as code?)

; Shaking camera
; ------------------

Graphics3D 640,480
SetBuffer BackBuffer()

camera=CreateCamera()

light=CreateLight()
RotateEntity light,90,0,0

; Create cone
cone=CreateCone()

PositionEntity cone,0,0,5

While Not KeyDown( 1 )

If KeyHit(57)
shaking = True
shake_strength# = 2.0
EndIf

shake_strength=shake_strength-0.02 ;Slowly remove the shaking strength
If shake_strength<0 shake_strength=0

If shake < 0
shaking = False
shake_strength = 0
EndIf

If shaking = True
TurnEntity camera,Sin(MilliSecs() Mod Rnd(350,360)) * shake_strength,Cos(MilliSecs() Mod Rnd(350,360)) * shake_strength,0 ; Use "rnd" to make the shaking more randomly
shake_strength = shake_strength - .9 * dt
EndIf


RenderWorld
Flip
Wend

End




I hope this is, what you wanted?