ShakeViewport

Category: Environment / Effects
Since engine version: 6.0 OC (extended in 9.0 OC)

Description

Shake the player viewports near the given position. This disorienting effect is used for earthquakes, explosions and other rumbling effects. The further away the player is from the source, the less his viewport is shaken. The strength falls off linearly by distance from 100% to 0% when the player is [range] pixels away. The accumulated strength of all shake sources is limited to a distortion of at most 500 pixels per player.

Syntax

void ShakeViewport(int level, int x, int x, int range);

Parameters

level:
The strength of the shake in pixels. As a point of reference, for explosions, the shake strength is the same as the explosion level.
x:
X offset in relative coordinates from the calling object.
x:
Y offset in relative coordinates from the calling object.
range:
[opt] Range from shake center at which the effect falls off to zero. Defaults to 700.
See also: SetViewOffset
Newton, 2015-01
Marky, 2019-04