Home   Help Search Login Register  

Author Topic: Shake Cam  (Read 1714 times)

0 Members and 1 Guest are viewing this topic.

Captain Winters

  • Guest
Shake Cam
« on: 07 Sep 2002, 23:34:30 »
whats the coditions for the shakecam.sqs ([?,?])

Thanks In Advance

Bremmer

  • Guest
Re:Shake Cam
« Reply #1 on: 08 Sep 2002, 01:04:03 »
Hello again Cpt  ;)

Getting a camera to shake is actually very similar to making it track - all you need is to vary the camera position slightly. You can do this by adding a small random component to the x,y,z positioning of the camera. The magnitude of the shake will be determined by the random factor you use (I find 0.3 about right for that hand-held camera effect) - play around with it until your happy.


;shakey_camera.sqs
;initiate with [name,x,y,z] exec "shakey_camera.sqs"
_unit = _this select 0
_x = _this select 1
_y = _this select 2
_z = _this select 3
stoptracking = false

_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
_cam camSetTarget _unit
_cam CamSetFOV 0.7
   
#loop
~0.05
_cam camSetRelPos [_x + random 0.3,_y + random 0.3,_z + random 0.3]
_cam camCommit 0
? not stoptracking : goto "loop"
_cam cameraeffect ["terminate", "back"]
camdestroy _cam
exit

crow

  • Guest
Re:Shake Cam
« Reply #2 on: 08 Sep 2002, 07:06:46 »
 :cheers:If it is the script from Drak try this;
use: [cameraname, shakiness] exec "shakecan.sqs"

; Shaking camera script - by Drak
; This will shake the camera, until 'endshake' becomes true

; use: [cameraname, shakiness] exec "shakecan.sqs"

_cam = _this select 0
_shakiness = _this select 1

_ox = getPos _cam select 0
_oy = getPos _cam select 1
_oz = getPos _cam select 2

endshake = 0

#shake
_rx = (random(_shakiness)) - (_shakiness / 2)
_ry = (random(_shakiness)) - (_shakiness / 2)
_rz = (random(_shakiness)) - (_shakiness / 2)
_cam camSetPos [_rx + _ox, _ry+_oy, _rz+_oz];
_cam camCommit 0
~0.05
_cam camSetPos [_ox, _oy, _oz];
_cam camCommit 0
~0.05
? (endshake==0) : goto "shake"

exit
 :cheers: