s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationSceneComponentsReferenceCamera Effects
SOURCE 2 · C#
Build and play games with s&box.

Facepunch's game engine and creation platform — make games in C#, or jump straight into community games.

Get s&box on Steam

s&box Wiki

  • Overview
  • Getting Started
  • Creating Games
  • Engine & Tools
  • Documentation
  • Community Games
  • Resources

Tools & Community

  • Getting Started
  • Creating Games
  • Engine & Tools
  • Resources

Platforms

  • RustBattle
  • CSBattle
  • Rust Game Wiki
  • CS2 Skins Wiki
  • Deadlock Wiki

About

  • Official Site
  • Developer Wiki
  • GitHub
  • Get on Steam
NOT AFFILIATED WITH FACEPUNCH STUDIOS · © 2026 s&box Wiki (community)
Docs/Scene
Scene

Camera Effects

Shake, punch and tilt on any CameraComponent. Effects stack, run out on their own, and don't touch the player's aim, they only move what's rendered.

// rumble the screen for a second
Scene.Camera.AddShake( amplitude: 5f, frequency: 40f, duration: 1f );

// kick the view up and let it bounce back, like recoil
Scene.Camera.AddPunch( new Angles( -2f, 0, 0 ) );

AddShake is a sustained rumble, a duration of zero shakes until you call Stop() on the returned effect. AddPunch is a single kick that springs back, either along a direction or in view angles, with an optional FOV punch for impact. AddTilt eases the camera to a lean and back, good for damage indication or peeking.

These are local. Call them on whichever client should feel them, from a damage callback for example.

EnvShake

EnvShake is the map component version, for earthquakes and explosions. Place it in a scene or Hammer map and it shakes every player within Radius, falling off toward the edge, or everywhere with GlobalShake. It can also kick nearby physics objects with ShakePhysics, and Rumble game controllers.

StartShake() and StopShake() control it, and they broadcast so every player gets the shake.

Custom effects

For a custom effect, implement ICameraModifier on a component and reshape the view in ModifyCamera. It runs once per camera per frame while the component is enabled, and CameraOrder decides who goes first. This is the same hook the player controller, vehicles and weapons use to drive the camera.

public class DrunkCamera : Component, ICameraModifier
{
	public void ModifyCamera( CameraComponent camera, ref CameraView view )
	{
		var sway = MathF.Sin( Time.Now * 2f ) * 5f;

		view.Rotation *= Rotation.FromRoll( sway );
		view.FieldOfView += sway;
	}
}

The view has the position, rotation, field of view and clip planes. Change whatever you like, the next modifier gets your result.

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2026-07-04. Read it rendered on the official docs.

More in Scene

Advanced Topics
Async
Component Interfaces
Component Methods
Component Versioning
Components
Events
Execution Order
← All documentation

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.