codeAPI Reference
s&box EnvironmentShake: Camera shake component
Component that creates camera shake effects based on distance and time curves. Implements ICameraSetup to apply rotation noise during PostSetup.
Properties
CSHARP
[Property]
public float Rate { get; set; } = 10.0f;
[Property]
public Angles Scale { get; set; } = new Angles( 100, 100, 0 );
[Property]
public float MaxDistance { get; set; } = 1024;
[Property]
public Curve DistanceCurve { get; set; } = new Curve( new( 0, 1 ), new( 1, 0 ) );
[FeatureEnabled( "Timed" ), Property]
public bool TimeLimited { get; set; } = false;
[Feature( "Timed" ), Property]
public float TimeLength { get; set; } = 5;
[Feature( "Timed" ), Property]
public Curve TimeCurve { get; set; } = new Curve( new( 0, 1 ), new( 1, 0 ) );
[Sync]
public TimeUntil EndTime { get; set; }Properties
CSHARP
public bool IsActive => !TimeLimited || EndTime > 0;Usage
Add to a GameObject to create a camera shake effect. The shake uses Perlin noise for smooth random rotation, attenuated by distance and optional time curves.
- Rate: Speed of noise variation
- Scale: Maximum rotation angles (pitch, yaw, roll)
- MaxDistance: Maximum range for effect
- DistanceCurve: Falloff curve over distance
- TimeLimited: If true, shake fades out over TimeLength
- TimeCurve: Falloff curve over time
Source
Used by explosions and environmental effects.
Was this helpful?