You are viewing a potentially older version of this package. View all versions.
Zaggy1024-OpenBodyCams-1.3.0 icon

OpenBodyCams

An open-source implementation of a body/head camera that is displayed on the bottom right monitor in the ship, with the goal of appearing almost identical to the player's actual perspective while providing good performance.

Date uploaded 2 months ago
Version 1.3.0
Download link Zaggy1024-OpenBodyCams-1.3.0.zip
Downloads 212796
Dependency string Zaggy1024-OpenBodyCams-1.3.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

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

Preferred version: 5.4.2100

README

OpenBodyCams

An open-source implementation of a body/head camera that is displayed on the bottom right monitor in the ship, with the goal of appearing almost identical to the player's actual perspective while providing good performance.

The camera view will display only the first person hands and disable the third person model as well as MoreCompany cosmetics to prevent obstructed vision.

Player pointing at the body cam screen displaying them pointing at the screen

Watching a player being eaten by a giant on the body cam

Nutcracker and Blob inside the mansion on the body cam

Please report any issues here, and include any relevant information according to the Debugging section.

Features

  • Selectable camera perspective between the head and body.
  • Camera view is designed to render identically for the local player and other players in the game.
  • MoreCompany and AdvancedCompany cosmetics support, see the Compatibility section.
  • All enemies, terrain, etc. that is visible to the player will be visible in the camera view.
  • The same green flash animation used when switching targets on the radar is displayed by the camera view.
  • Performance:
    • The camera is attached to the player model in the engine rather than copying the transform from it.
    • Camera setup logic is done ahead of time based on game events whenever possible.
  • A opt-in view bodycam command in the terminal displays the body cam when viewing the radar map. See Configuration/Terminal

Compatibility

MoreCompany cosmetics, AdvancedCompany cosmetics and equipment, and third-person model replacements by ModelReplacementAPI and LethalVRM are supported. They will be hidden when viewing other players in the body cam, and your cosmetics/models will be visible on the camera when you are viewing another player looking at you.

GeneralImprovements's extended monitors set is supported through a config option to select the monitor number to use for the body cam. The body cam will override any selection in the GeneralImprovements config.

TwoRadarMaps will use a separate body cam for the picture-in-picture view in the terminal when EnablePiPBodyCam is enabled.

Configuration

Camera options

  • Mode: The attachment point of the camera. The head and the body are selectable.
  • HorizontalResolution: The horizontal resolution of the rendered view.
  • FieldOfView: The vertical FOV of the body cam's view.
  • RenderDistance: The far clip plane of the camera.
  • Framerate: The number of frames to render per second. The default setting renders at the game's framerate and has the least impact on performance.
  • NightVisionBrightness: A multiplier for the brightness and range of the night vision light. A value of 1 matches the vision of the player being viewed.
  • MonitorEmissiveColor: The color to emit from the screen displaying the body cam. Represented as comma-separated numbers to avoid losing precision by using a 32-bit color.
  • MonitorTextureFiltering: Changes the texture filtering applied to the screen for the body cam. Point will result in sharp edges on the pixels, while bilinear and trilinear should both smooth out colors between them.
  • RadarBoosterPanRPM: This controls the number of turns that the camera should make each minute. If set to 0, the camera will be fixed in the direction that the player placing the radar booster was facing.
  • UseTargetTransitionAnimation: If enabled, the body cam will display a green flash animation when changing targets to mirror the behavior of the radar map.
  • DisableCameraWhileTargetIsOnShip: This will cause the screen to turn off while the camera's target is onboard the ship. This can be used to avoid the load of rendering large numbers of items on the ship in long runs.
  • EnableCamera: When this is enabled, the screen will be powered off. This can be changed in-game with LethalConfig or any similar mod.

Terminal

  • EnablePiPBodyCam: Off by default, this adds a view bodycam command to the terminal that displays the body cam in one corner of the radar map. When the radar map is hidden, the body cam will be hidden as well.
  • PiPPosition: Selects the corner of the radar map that the body cam view in the terminal should reside in.
  • PiPWidth: Sets the horizontal size of the body cam view in the terminal. This does not affect the render resolution of the camera.

Miscellaneous

  • DisableInternalShipCamera: Disables the camera at the front of the ship facing towards the center. This may improve performance inside the ship slightly.
  • FixDroppedItemRotation: Defaulted to true, this fixes a desync of items' rotations when dropping them. See Notes/Item rotations.

Debug

See Debugging.

Notes

Framerate limits

As mentioned above, using no framerate limit results in the best performance. Forcing the camera to render at certain intervals outside of the render pipeline seems to cause a lot of overhead, so setting the framerate limit to anything above 30fps may cause a severe dip in the game's framerate.

Item rotations

An optional fix is included for items' rotations being desynced between the player dropping them and all other clients, which is caused by an ignored rotation parameter in the function handling dropped items. This is included to allow the radar boosters to face in a consistent direction for all clients in a game. The patch is designed to fail gracefully and allow the mod to still run, in case any other mods apply the same fix, but if problems arise, it can be disabled with the FixDroppedItemRotation config option.

Debugging

When providing logs for issues you encounter, PLEASE make sure to enable Unity logging!

  • Set BepInEx's UnityLogListening option in the [Logging] section to true.
  • Set BepInEx's LogLevels option in the [Logging.Disk] section to All.
  • Disable DisableUnityLogs if installed.

Otherwise, there will be no error messages printed in the logs at all, and I cannot narrow down the cause of the problem.

The logs can be found in the BepInEx folder within the mod manager's profile folder (%appdata%\r2modmanPlus-local\LethalCompany\profiles\[profile name] for r2modman), or inside the game's Steam install folder. Please ensure that the modification date indicates that the file is the most recent launch of the game.

Screen freezes/error spam

If error spam or screen freezes are encountered, please reproduce the issue with ReferencedObjectDestructionDetectionEnabled enabled in the [Debug] section of the config, then provide the game logs in a new issue on GitHub (see Debugging to find the .log file). The option prints a message and stack trace whenever an object is destroyed while a body cam is referencing it. This should point directly to any problematic mods causing issues.

After the issue occurs, BruteForcePreventFreezes can be used to resume normal gameplay. The option prevents the error spam by checking every frame whether any cosmetics on viewed players have been destroyed and updating the list if so. This can be used as a stopgap measure to prevent screen freezes if a mod conflict is unavoidable.

"Collected cosmetics" spam

If messages are spammed excessively in the console/logs saying Collected [x] cosmetics objects for [name], then the PrintCosmeticsDebugInfo can be enabled to provide information on what is causing the collection of the cosmetics. Enable this option while the issue is occurring and provide the logs in a GitHub issue (see Debugging to find the .log file). It will print extra information about the cosmetics being collected for each player, as well as the code that is causing the cosmetics to be collected.

Developers

If you wish to create a body cam separate from the default one included with this mod, you can simply add OpenBodyCams as a dependency and use OpenBodyCams.API.BodyCam.CreateBodyCam():

var doorScreen = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/SingleScreen");
BodyCam.CreateBodyCam(doorScreen, doorScreen.GetComponent<MeshRenderer>(), 1, StartOfRound.Instance.mapScreen);

The body cam component will be attached to the provided GameObject, and use the provided Renderer to check whether the display it is on is being rendered.

The displayMaterialIndex argument indicates which of the shared materials on the renderer should be replaced by the body cam's render texture. The texture that is in that index originally will be stored by the body cam, and when SetScreenPowered(false) is called, it will replace the body cam's output on the display. The body cam's output can then be brought back with a SetScreenPowered(true) call.

The ManualCameraRenderer argument must be a map renderer where its cam field is the same reference as its mapCamera field. However, the argument may be null, in which case the body cam's target may be controlled directly.

CHANGELOG

Version 2.1.2

  • Fixed centipede tracking thinking a centiped was clinged to two players at once if two clients send messages that they are being clinged at the same time. This is likely the cause of the issue that was worked around in 2.1.1.

Version 2.1.1

  • Tentatively fixed NullReferenceExceptions which could occur when a centipede clings to a player's head.
  • Prevented NullReferenceExceptions when running LethalPipeRemoval to destroy the door screen.

Version 2.1.0

  • Modified the HorizontalResolution option to only affect the main body cam. API users can now set the Resolution property to override the default resolution of 160x120.

Version 2.0.6

  • Prevented a NullReferenceException when API users (TwoRadarMaps, darmuhsTerminalStuff) create a body cam that is synchronized with a radar map.
  • Removed the warning that DisplayOriginalScreenWhenDisabled will not work when GeneralImprovements's UseBetterMonitors is enabled.

Version 2.0.5

  • Added support for falling back to GeneralImprovements's monitor assignments when the body cam is disabled.
  • Fixed the monitor index ordering with GeneralImprovements's UseBetterMonitors on and AddMoreBetterMonitors off.

Version 2.0.4

  • Fixed an error that could occur when darmuhsTerminalStuff tried to create a body cam, caused by some debug logging that is now removed.
  • Added a tip upon the first load into a game on 2.0.4 to notify users that the body cams are a ship upgrade now.

Version 2.0.3

  • Prevented error spam that would occur when a body cam switches from targeting a solo player to targeting nothing.
  • Fixed a long-standing issue where the body cam would not switch back on if it was targeting a dead player with no corpse while players respawned.
  • Fixed invalid targets sometimes displaying on the body cam after the 2.0.0 update.
  • Only disable the main body cam based on the EnableCamera option, and exclude any body cams created by API users.

Version 2.0.2

  • Fixed the antenna prefab not spawning on clients.

Version 2.0.1

  • Switched the default value for the ship upgrade option to be true by default as it was intended to be in 2.0.0. Old values will be migrated.
  • Fixed a compatibility issue with darmuhsTerminalStuff's minicams command.
  • Prevented errors that would occur when the debugging options are enabled.

Version 2.0.0 (requires v50)

  • Added a ship upgrade to enable body cams for 200 credits which is enabled by default if LethalLib is installed.
  • Added support for adjusting the position of tulip snakes and snare fleas based on the view perspective.
  • Added support for vanilla cosmetics (bunny ears, bee antennae).
  • The screen that the body cam occupies will now switch back to the camera that originally displayed when the body cam is invalid, when GeneralImprovements's UseBetterMonitors is not enabled.
  • Added an option to swap the external and internal cameras' positions when GeneralImprovements's UseBetterMonitors is not enabled.
  • Added an option to modify the external camera screen's emissive color.
  • Fixed an issue where the radar map's night vision light would be visible on body cams when CullFactory is enabled.
  • The camera that is replaced by the body cam will now be disabled to improve performance.
  • Allowed API users to override a body cam's resolution and DisableCameraWhileTargetIsOnShip option.

Version 1.3.0

  • Fixed a long-standing issue where MoreCompany cosmetics being destroyed on a masked enemy would cause a freeze.
  • Significantly reworked how cosmetics are updated. These changes may introduce old or new bugs, please report them on GitHub.

Version 1.2.11

  • Fixed error spam that would occur when the Advanced Company light shoes curse was lifted.

Version 1.2.10

  • Prevent errors when body cams are immediately destroyed between setting and resetting the perspective.

Version 1.2.9

  • Fixed a freeze/error spam that would occur if MoreCompany encountered an error while syncing cosmetics.

Version 1.2.8

  • Fixed the green transition animation becoming permanently frozen on the body cam screen if UseTargetTransitionAnimation was disabled.

Version 1.2.7

  • Fixed the green transition appearing on the player's view when switching from a dead body or mimic to that player. The transition could remain visible until the target was switched again if DisableCameraWhileTargetIsOnShip was enabled.
  • Allowed DisableCameraWhileTargetIsOnShip to disable body cams based on whether other targets types (corpses, masked players, and radar boosters) are on the ship.

Version 1.2.6

  • Fixed the body cam not powering back on after the monitors are turned off.

Version 1.2.5

  • Fixed an error that would occur if the door screen was destroyed.

Version 1.2.4

  • Fixed disabling the transition animation causing the green rectangle to get stuck on the body cam screen. Note that this probably doesn't fix issue #23.

Version 1.2.3

  • Optimized some hot code which may help performance very slightly.

Version 1.2.2

  • Added two options to allow collection of useful debug information if error spam is encountered, information which should point directly to the problematic mod. More information is available in the readme.
  • Prevented cosmetics from being collected from other mods if they have been destroyed. Not sure if this has been hit in the wild, but this may prevent some error spam.

Version 1.2.1

  • Fixed an error that would occur when exiting to the menu and starting a game again with the picture-in-picture body cam enabled.

Version 1.2.0

  • Added an opt-in view bodycam command to the terminal to display a picture-in-picture view of the bodycam. TwoRadarMaps v1.2.0 will use a separate bodycam when the feature is enabled.
  • Developer features: Added an API to force a body cam to render, and allowed body cams to function without being attached to a renderer's visibility/materials.

Version 1.1.6

  • (Tentatively) fixed an error that could softlock the ship when viewing a player with a custom ragdoll. This could occur when a player was killed by Herobrine mod.

Version 1.1.5

  • Fixed error spam that would occur when changing AdvancedCompany cosmetics.
  • Made the PrintCosmeticsDebugInfo option work when enabled at startup.

Version 1.1.4

  • Added an option to disable the green flash animation displayed when changing targets on the body cam.
  • HDLethalCompany graphics options will now apply to the body cam.

Version 1.1.3

  • Fixed compatibility for MoreCompany versions greater than 1.8.0. Note that there appears to be an issue where upon joining a server, cosmetics may appear blocking the view of the body cam, which may be caused by an error in MoreCompany.

Version 1.1.2

  • Fixed error spam that could occur when changing models with ModelReplacementAPI.
  • Added a debug option that prints extra information about which cosmetics are being collected for each player, and the reason they are being collected. If you have issues with cosmetics/model replacements, I may ask for you to enable this to get new logs.

Version 1.1.1

  • Hopefully prevented an issue where in rare cases, masked players being viewed by the body cam would cause the screen to freeze. This was perhaps caused by other mods deleting renderers attached to the masked players after they were created.

Version 1.1.0

  • Refactored the mod to allow creation of multiple body cams through an API. This feature is not used in OpenBodyCams, but may be used in the future to provide a separate body cam for the terminal, or other use cases.
  • When no valid target is selected (i.e. when players are still respawning), the screen will now display nothing, but it will remain illuminated to indicate that it is still powered.
  • Fixed an issue where the screen would get frozen with the green transition visible when a radar booster is left behind on a planet.
  • Note: Due to refactoring much of the code that reacts to the events in the game, I'm anticipating there may be regressions in the way the body cam tracks its target's status changes (death, masking, respawning). If the camera gets stuck displaying something unexpected, please report that (preferably through a GitHub issue) with steps to reproduce the problem.

Version 1.0.24

  • Added support for ModelReplacementAPI's third person model replacements.
  • Added support for LethalVRM's third person model replacements.

Version 1.0.23

  • Fixed the external camera staying frozen when looking at the screen by the door controls.

Version 1.0.22

  • Added handling of AdvancedCompany equipment to the compatibility feature, preventing equipped items from obstructing the body cam.

Version 1.0.21

  • Fixed all cameras in the ship staying enabled when looking away from the front of the ship with DisableInternalShipCamera off. The internal camera is disabled if its screen is not visible to any camera but its own, which occurs when it is not visible to the player.

Version 1.0.20

  • Fixed parsing of the emissive color option in locales that use , as their decimal separator.

Version 1.0.19

  • Added an option to adjust the emissive color of the body cam screen.
  • Added an option for the panning speed for cameras when attached to a radar booster. When set to 0, the camera will be stationary and face in the direction the player was looking when placing the radar booster.
  • Implemented an optional fix for dropped item rotation being desynced between the player dropping the item and other players. This will affect all items in the game. Without this fix, radar boosters will not face in the direction that they were dropped by the player that had been holding them.
  • Allowed the camera to be disabled when the player being viewed enters the ship to avoid rendering the items on board twice.

Version 1.0.18

  • Fixed the radar map not disabling correctly when it was not visible, or while the player is outside the ship.

Version 1.0.17

  • Fixed body cams being unable to display on the GeneralImprovements large monitors with UseBetterMonitors enabled.

Version 1.0.16

  • Fixed a reduction in performance that began in version 1.0.14 with the fix for the DisableInternalShipCamera bug.

Version 1.0.15

  • Updated GeneralImprovements compatibility to work with version 1.1.1. This updated compatibility will not work with any previous versions of GeneralImprovements.

Version 1.0.14

  • Fixed a bug that caused error spam when MoreCompany compatibility was being used.
  • Forced the radar map to keep rendering when interacting with the terminal while the DisableInternalShipCamera option is enabled.

Version 1.0.13

  • Supported the GeneralImprovements UseBetterMonitors option with a config option to select the monitor number to display the body cam on.

Version 1.0.12

  • Stopped placing the body cam on the monitor by the door.
  • Reduced the emissivity of the bodycam monitor.

Version 1.0.11

  • Added an option to turn the body cam screen off, which can be used in-game if performance issues are encountered.

Version 1.0.10

  • Added support for AdvancedCompany cosmetics. They should now be hidden on the body cam when viewing other players.

Version 1.0.9

  • Made the bodycam monitor turn off when the radar map is powered down by the button or a lightning strike.

Version 1.0.8

  • Added an option to adjust the brightness of the night vision light. This can be used to counteract the green tint of the screen making it difficult to see when players are in dark areas.

Version 1.0.7

  • Fixed a compatibility issue with Immersive Visor which would cause the body cam to render to the screen instead of a texture when a player respawned.
  • Prevented the radar map's night vision light from showing up on the body cam.

Version 1.0.6

  • Prevented MoreCompany cosmetics from appearing and obstructing the view when joining a game with the camera viewing someone with cosmetics equipped.
  • Made the body cam attach to dead bodies on clients other than the one of the player that died.

Version 1.0.5

  • Fixed an compatibility issue with MirrorDecor that caused the first person arms to be invisible in the body cam.

Version 1.0.4

  • Fixed an issue where the local player's body would be invisible in the body cam with LethalEmotesAPI or MirrorDecor installed.

Version 1.0.3

  • Fixed an error that would occur when a third person emote was started by the LethalEmotesAPI mod.
  • Added a config option to disable MoreCompany cosmetic support that can be used if compatibility issues arise.

Version 1.0.2

  • Fixed error spam that would occur if the camera was attached to an enemy or dead body being destroyed after a round ends.

Version 1.0.1

  • Fixed an error that would occur when MoreCompany is not installed.

Version 1.0.0

  • Initial release.