Dogfights Camera Shake
Blitz3D Forums/Blitz3D Programming/Dogfights Camera Shake
| ||
I'm trying to recreate the camera shake from the show Dogfights. When they do a fly-by shot, as soon as the aircraft passes the camera, the camera shakes. I'd like to use Millisecs() for this but I'm open to all options.If KeyHit(57) shaking = True shake_strength# = 2.0 EndIf If shake < 0 shaking = False shake_strength = 0 EndIf If shaking = True TurnEntity camera,Sin(MilliSecs() Mod 360) * shake_strength,Cos(MilliSecs() Mod 360) * shake_strength,0 shake_strength = shake_strength - .9 * dt EndIf I need it to be more random (not circular) and slowly return to a steady state. |
| ||
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? |
| ||
Wow...very choppy. I'm looking for something random but very smooth. |
| ||
Chroma, Try supercam function from the code archives, and send it rnd parameters every 5 loops or something like that. Supercam makes the camera fluidly move from where it is to where its going based on a camera and an object to 'follow'. It may do the job if you just move the object to follow around randomly! IPete2. |