shakeCamera
Client-side
Server-side
Shared
Added in 1.6.0 r22631
This function allows you to trigger camera shake effect (just like explosion does).
Note
- The camera shaking duration depends on the force. High values can result in very long durations. That's why resetShakeCamera exists.
- If position not given, it will defaults to local player position.
Syntax
bool shakeCamera ( float force, [ float x = nil, float y = nil, float z = nil ] )Required Arguments
- force: Intensity and time of the shake. The higher the value, the longer the camera shakes.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- x (default: nil): Center X coordinate of the shake.
- y (default: nil): Center Y coordinate of the shake.
- z (default: nil): Center Z coordinate of the shake.
Returns
- bool: result
Always returns true.
Code Examples
client
This example allows you to constantly trigger camera shake effect in center of the map, the closer you are to center the stronger effect will be.
local shakeStrength = 1.4 -- define strength of the camera shakelocal shakePosX, shakePosY, shakePosZ = 0, 0, 3 -- define position where camera shake would happen
function triggerCameraShake() shakeCamera(shakeStrength, shakePosX, shakePosY, shakePosZ) -- trigger camera shakeendsetTimer(triggerCameraShake, 100, 0) -- call this function indefinitely, every 100 msSee Also
Camera Functions
- fadeCamera
- getCamera
- getCameraClip
- getCameraDrunkLevel
- getCameraFieldOfView
- getCameraGoggleEffect
- getCameraInterior
- getCameraMatrix
- getCameraTarget
- getCameraViewMode
- resetShakeCamera
- setCameraClip
- setCameraDrunkLevel
- setCameraFieldOfView
- setCameraGoggleEffect
- setCameraInterior
- setCameraMatrix
- setCameraTarget
- setCameraViewMode
- shakeCamera