Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
API
Updated 4 days agoCamera Overhaul API
Camera Overhaul writes the local players camera rotation every frame. If your mod wants to shake or punch that camera, use this instead of writing gameplayCamera.transform yourself.
Vanilla shake
If your mod already calls vanillas screen shake, it works with Camera Overhaul with no changes:
HUDManager.Instance.ShakeCamera(ScreenShakeType.Big);
Camera Overhaul listens for that call. On its own it slides the whole rendered image in screen space, about 22 px at 1080p. With Camera Overhaul installed the camera rotates for real and that flat slide is turned off.
| Type | What it maps to |
|---|---|
Small |
bump |
Big |
solid hit |
Long |
quiet but lasts about a second |
VeryStrong |
strongest one |
Constant |
ignored, Camera Overhaul handles the ship takeoff itself |
If you patch ShakeCamera with a prefix that returns false, Camera Overhaul stays quiet too.
Events Camera Overhaul already does itself keep their own settings and ignore the vanilla call: explosions, your own shotgun, taking damage, the Earth Leviathan, cruiser hits, your own jetpack, and the Company desk past 30 m. Your own calls pass through unless they run inside one of those, like from a DamagePlayer postfix.
Camera Overhaul owns the shake, so it suppresses the games own slide for Small, Big, Long and VeryStrong and rotates the camera instead. It hands the slide back whenever it can't replace it: ExternalSuppression above 0, MasterStrength at 0, Constant, or a frame where SkipVanillaShake() ran. A third person camera that suppresses still leaves the player the game's own shake.
Use the API below when you need something ShakeCamera can't do: direction, longer shake or suppression.
Setting up
Take it as a soft dependency:
[BepInDependency("com.seeya.cameraoverhaul", BepInDependency.DependencyFlags.SoftDependency)]
You can either reflect into CameraOverhaul.CameraOverhaulApi or reference CameraOverhaul.dll with Private="False" so it isn't shipped in your package. If you reference it directly, keep the calls in their own method and mark it [MethodImpl(MethodImplOptions.NoInlining)]. Otherwise the missing type can throw when the calling method is JIT'd, not where you expect:
static bool Present => Chainloader.PluginInfos.ContainsKey("com.seeya.cameraoverhaul");
[MethodImpl(MethodImplOptions.NoInlining)]
static void Shake(float trauma) => CameraOverhaulApi.AddTrauma(trauma);
Suppressing effects
More for third person cameras, cutscenes and anything where the effects would fight you.
CameraOverhaulApi.ExternalSuppression = 1f; // your camera
CameraOverhaulApi.ExternalSuppression = 0f; // give it back
Anything in between fades, use that while blending into your own camera.
One shared value, no ownership. If two mods suppress at once, the last write wins and whichever one releases first cancels the other.
Screen shake
Shake is trauma based. You add trauma, it decays and angle scales with trauma squared.
| Method | What it does |
|---|---|
AddTrauma(float amount) |
adds to current trauma, up to max of 3 |
BumpTrauma(float level) |
raises trauma to level if it is lower, never stacks |
BumpTrauma(float level, float hold) |
same but keeps it at that level for hold seconds before decaying |
At default intensity:
| Trauma | Angle per axis |
|---|---|
| 0.5 | 0.62° |
| 1.0 | 2.46° |
| 2.0 | 8.19° |
| 3.0 | 11.45° |
1.0 is roughly hard landing. Don't call AddTrauma every frame.
Camera kicks
CameraOverhaulApi.AddKick(new Vector3(-2f, 0f, 0f));
x is pitch, y is yaw, z is roll. Negative pitch kicks view up. This runs through the same spring as landing dip and weapon recoil so it overshoots slightly and settles instead of snapping back.
strength is a spring impulse, not degrees:
| strength | Angle |
|---|---|
| 1.0 | 0.300° |
| 4.0 | 1.200° |
| 10.0 | 3.000° |
| 30.0 | 9.0° |
For a kick away from world space impact, convert to camera space first:
Vector3 local = player.gameplayCamera.transform.InverseTransformDirection(force.normalized);
CameraOverhaulApi.AddKick(new Vector3(local.z * strength, 0f, -local.x * strength));
There is also SkipVanillaShake(), which makes Camera Overhaul ignore every vanilla ShakeCamera call for the rest of the current frame. Call it right before you fire a vanilla shake when you want to supply your own reaction instead. Before, not after: the check runs in the prefix, so a late call leaves the game's slide suppressed and Camera Overhaul quiet, and you get neither.