API ReferenceSandbox.Mapping

EnvShakeclass

Shakes players' screens - and optionally physics objects - around a point. Half-Life's env_shake. Call `Sandbox.Mapping.EnvShake.StartShake` to set it off on every player, and it runs a `Sandbox.Mapping.EnvShake.Duration` second cycle, the curves shaping it over that time. `Sandbox.Mapping.EnvShake.Loop` repeats the cycle until turned off.

objectComponentEnvShake
Namespace
Sandbox.Mapping
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.Mapping.EnvShake : Sandbox.Component

Constructors1

Showing 1 constructors

Methods2

Showing 2 methods

public void StartShake()PUBLIC

Set the shake off on everyone, restarting the cycle if it's already running.

Returns:void

public void StopShake()PUBLIC

Stop a running shake on everyone.

Returns:void

Properties11

Showing 11 properties

public Sandbox.ParticleFloat Sandbox.Mapping.EnvShake.Amplitude { get; set; }PUBLICGETSET

How far the view gets thrown over the cycle, in world units.

Returns:ParticleFloat

public float Sandbox.Mapping.EnvShake.Duration { get; set; }PUBLICGETSET

Seconds one shake cycle lasts - the curves play out over this.

Returns:float

public Sandbox.ParticleFloat Sandbox.Mapping.EnvShake.Frequency { get; set; }PUBLICGETSET

Direction changes per second over the cycle - low is a slow lurch, high is a violent tremble.

Returns:ParticleFloat

public bool Sandbox.Mapping.EnvShake.GlobalShake { get; set; }PUBLICGETSET

Shake every player in the scene at full strength, no matter where they are.

Returns:bool

public bool Sandbox.Mapping.EnvShake.Loop { get; set; }PUBLICGETSET

Restart the cycle when it ends, shaking until turned off.

Returns:bool

public bool Sandbox.Mapping.EnvShake.On { get; set; }PUBLICGETSET

Is the shake running? Local to this machine - map-placed shakes start everywhere because the scene ships with it set, but toggling it at runtime only affects this peer. Use `Sandbox.Mapping.EnvShake.StartShake`/`Sandbox.Mapping.EnvShake.StopShake` to run one on every player. A non-looping shake turns itself off when its cycle ends.

Returns:bool

public float Sandbox.Mapping.EnvShake.Radius { get; set; }PUBLICGETSET

How far the shake reaches, fading to nothing at the edge. The view ignores this when `Sandbox.Mapping.EnvShake.GlobalShake` is set - physics always uses it.

Returns:float

public bool Sandbox.Mapping.EnvShake.Rumble { get; set; }PUBLICGETSET

Rumble controllers along with the shake.

Returns:bool

public Sandbox.ParticleFloat Sandbox.Mapping.EnvShake.Scale { get; set; }PUBLICGETSET

Overall strength over the cycle - fade the whole shake in or out without retuning the others.

Returns:ParticleFloat

public bool Sandbox.Mapping.EnvShake.ShakePhysics { get; set; }PUBLICGETSET

Throw physics objects around within `Sandbox.Mapping.EnvShake.Radius` while shaking.

Returns:bool

public bool Sandbox.Mapping.EnvShake.ShakeView { get; set; }PUBLICGETSET

Shake the view. Turn off for a physics-only shake.

Returns:bool

On this page