ShakeCamera: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Adjust version.)
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Client function}}  
{{Client function}}  
__NOTOC__
__NOTOC__
 
{{Added feature/item|1.6.1|1.6.0|22631|  
<!-- Change to proper build from https://buildinfo.multitheftauto.com -->
{{Added feature/item|1.6.1|1.6.0|22629|  
This function allows you to trigger camera shake effect (just like explosion does).
This function allows you to trigger camera shake effect (just like explosion does).
}}
}}
Line 25: Line 23:


==Example==  
==Example==  
TODO
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.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO
local shakeStrength = 1.4 -- define strength of the camera shake
local shakePosX, shakePosY, shakePosZ = 0, 0, 3 -- define position where camera shake would happen
 
function triggerCameraShake()
shakeCamera(shakeStrength, shakePosX, shakePosY, shakePosZ) -- trigger camera shake
end
setTimer(triggerCameraShake, 100, 0) -- call this function indefinitely, every 100 ms
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Client camera functions}}
{{Client camera functions}}

Revision as of 12:03, 22 July 2024

BETA: NEW FEATURE (BUILD: 1.6.0 r22631)

This function allows you to trigger camera shake effect (just like explosion does).

Syntax

bool shakeCamera ( float power, [ float x, float y, float z ] )

Required arguments

  • power: Intensity and time of the shake.

Optional Arguments

  • x: Center X coordinate of the shake.
  • y: Center Y coordinate of the shake.
  • z: Center Z coordinate of the shake.

If not given, it will defaults to local player position.

Returns

Always returns true.

Example

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 shake
local shakePosX, shakePosY, shakePosZ = 0, 0, 3 -- define position where camera shake would happen

function triggerCameraShake()
	shakeCamera(shakeStrength, shakePosX, shakePosY, shakePosZ) -- trigger camera shake
end
setTimer(triggerCameraShake, 100, 0) -- call this function indefinitely, every 100 ms

See Also

Edit-delete.png This page is marked for deletion.

Reason: New template: here
Actions: Delete (Administrators) - Discuss - What links here - Category


Shared