EvilMcEvilFace-CCTVBodyAnchorFix icon

CCTVBodyAnchorFix

Keeps the first-person camera attached to your body after using LethalCCTV's CCTV station or mainframe. Stops a leftover station camera hold from leaving your view parked away from your character.

Last updated 2 hours ago
Total downloads 12
Total rating 0 
Categories AI Generated
Dependency string EvilMcEvilFace-CCTVBodyAnchorFix-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2305
Y4NGZ313-LethalCCTV-1.3.8 icon
Y4NGZ313-LethalCCTV

Viewable security cameras, alarms, and locked stashes all controlled by a mainframe in the facility.

Preferred version: 1.3.8

README

CCTV Camera Body Anchor Fix

A small BepInEx addon for LethalCCTV that fixes the glitch where your first-person camera separates from your body after using the ship CCTV station or the facility mainframe.

What is actually happening

LethalCCTV seats you at the station by moving your player root and re-aiming the first-person camera. To keep the view steady while it does that, it:

  1. Captures the camera container's body-local offset (PlayerControllerB.cameraContainerTransform measured in player-root space) in MonitorFocus.CaptureStationPlayerPoseSnapshot / _stationPlayerCameraPlayerLocalPosition.
  2. Adds CCTVLocalCameraPositionStabilizer to the camera container and, every LateUpdate, forces container.position = playerRoot.TransformPoint(capturedBaseline).
  3. Restores the player pose and the camera container in MonitorFocus.RestoreStationPlayerPoseTracking when you stand up.

When the session ends through a path that does not run that restore, or something else cancels the interaction, the hold can stay on or the container can be released at the station offset instead of the body offset. Your view is then no longer at your character's eyes: the camera has separated from the body.

The mod's own diagnostics (Camera Trace, the 5 mm shift note, CCTVLocalCameraPositionStabilizer) confirm the camera container's body-local position is the quantity that must stay fixed.

What the addon does

CameraBodyAnchorGuard runs at execution order 32001, after LethalCCTV's stabilizer at 32000, and every frame:

  • Learns the normal body-local camera offset, with separate references for standing and crouching.
  • Reads LethalCCTV's own focus state (IsFocused, IsFocusExitInProgress, IsEntryPoseSettleActive) through reflection, so it never touches the camera while a station or mainframe session legitimately owns it.
  • After a session, if the camera container stays more than Maximum Camera Offset away from the body offset for longer than Correction Delay, it moves it back.
  • If a CCTVLocalCameraPositionStabilizer is still holding the camera after the session has closed (the stuck-hold case), it stops it once Stale Hold Cleanup has elapsed.

All LethalCCTV access is by reflection, so the addon has no compile-time dependency on a specific LethalCCTV build and simply idles if the mod is not installed.

Install

  1. Install BepInEx 5 and LethalCCTV as usual.
  2. Drop CCTVBodyAnchorFix.dll into BepInEx/plugins/CCTVBodyAnchorFix/.
  3. Everyone in the lobby should use the same build, as with LethalCCTV itself.

Settings

BepInEx/config/com.cctvbodyanchorfix.lethalcompany.cfg, section General:

Setting Default Meaning
Enabled true Turn the guard on or off.
Maximum Camera Offset (m) 0.3 Distance from the body before the camera counts as separated.
Correction Delay (s) 0.75 How long it must stay separated before being moved back.
Stale Hold Cleanup (s) 2 Delay before stopping a leftover station camera hold; 0 disables it.
Log Corrections true One log line per correction, rate limited to one every 5 s.

Build

dotnet build final/CCTVBodyAnchorFix/CCTVBodyAnchorFix.csproj -c Release \
  -p:GameDir="C:/Program Files (x86)/Steam/steamapps/common/Lethal Company"

GameDir (or the LETHAL_COMPANY_DIR environment variable) must point at the install that contains Lethal Company_Data/Managed and BepInEx/core. Add -p:DeployToPlugins=true to copy the DLL into BepInEx/plugins/CCTVBodyAnchorFix.

Notes and limits

  • Built from the shipped LethalCCTV 1.3.8 code. The probe retries once a second until it finds LethalCCTV, because plugin load order is not guaranteed for a soft dependency. If LethalCCTV is not installed or not loaded, the addon stays idle so it cannot fight other camera mods.
  • The included CCTVBodyAnchorFix.dll is the Release build. If your game build differs, rebuild from the sources in this folder.
  • Verified by compiling against the Lethal Company managed assembly surface; it was not run inside the game in this workspace, so behaviour on a live lobby still needs a playtest. Watch the BepInEx log for [CCTVBodyAnchorFix] lines while reproducing the glitch.