Skip to content

Camera

Camera helpers for Lilia third-person view, realistic first-person view, freelook input, and local-player visibility handling.


Overview

The camera library centralizes clientside camera behavior under `lia.camera`. It controls when third-person view may override the default view, builds collision-safe third-person camera positions, supports realistic first-person body rendering, applies freelook angle offsets, and hides local head/headwear geometry when needed for first-person body visibility.

lia.camera.isCharacterMenuOpen()View Source

Purpose

Checks whether any loading or character menu panel is currently open.

Realm

Client

Returns

boolean True when a character-related UI panel is open.


lia.camera.isUsingThirdPersonCamera(client)View Source

Purpose

Checks whether the player is currently using the Lilia third-person camera override.

Realm

Client

Parameters

Player client The player whose view entity and camera eligibility should be checked.

Returns

boolean True when the player's view entity is themselves and third-person override is available.


lia.camera.shouldSuppressRealisticView(client)View Source

Purpose

Determines whether realistic first-person view should be temporarily suppressed.

Realm

Client

Parameters

Player client The player whose input state should be checked.

Returns

boolean True when realistic view should be blocked for the current frame.


lia.camera.canOverrideView(client)View Source

Purpose

Determines whether the client may currently use the Lilia third-person camera override.

Realm

Client

Parameters

Player client The player whose camera state should be checked.

Returns

boolean True when third-person view is enabled, configured, and not blocked by menus, vehicles, ragdolls, or hooks.


lia.camera.canUseRealisticView(client)View Source

Purpose

Determines whether realistic first-person body view may be used for the local player.

Realm

Client

Parameters

Player client The local player being checked.

Returns

boolean True when realistic view is enabled and no state blocks it.


lia.camera.canUseFreelook(client)View Source

Purpose

Determines whether freelook can be applied to the local player's current view.

Realm

Client

Parameters

Player client The local player being checked.

Returns

boolean True when freelook is enabled and available.


lia.camera.isInSights(client)View Source

Purpose

Checks whether the player is aiming down sights with the active weapon.

Realm

Client

Parameters

Player client The player whose weapon and input state should be checked.

Returns

boolean True when ADS blocking is enabled and the player is considered in sights.


lia.camera.isHoldingFreelookBind(client)View Source

Purpose

Checks whether the player is holding the freelook bind or the fallback walk key.

Realm

Client

Parameters

Player client The local player whose input state should be checked.

Returns

boolean True when freelook input is currently being held.


lia.camera.resetFreelookState()View Source

Purpose

Resets freelook offsets and smoothed freelook angles back to neutral.

Realm

Client


lia.camera.beginFreelook(client)View Source

Purpose

Captures the player's current eye angles and marks freelook as actively held.

Realm

Client

Parameters

Player client The local player beginning freelook.


lia.camera.endFreelook()View Source

Purpose

Ends active freelook and clears all freelook offsets.

Realm

Client


lia.camera.shouldDrawBodyForFreelook(client)View Source

Purpose

Determines whether the local player's body should be drawn for freelook.

Realm

Client

Parameters

Player client The local player being checked.

Returns

boolean True when freelook is active or still easing back toward center.


lia.camera.getFirstPersonHeadBones(client)View Source

Purpose

Finds and caches head, neck, collar, clavicle, and upper chest bones for first-person hiding.

Realm

Client

Parameters

Player client The player model whose bones should be inspected.

Returns

table A cached list of bone indexes that should be hidden in first-person body view.


lia.camera.getFirstPersonHeadBoneChildren(client, rootBone)View Source

Purpose

Collects child bones parented under a first-person head-related root bone.

Realm

Client

Parameters

Player client The player model whose skeleton should be inspected.

number rootBone The root bone index used to find descendants.

Returns

table A list of child bone indexes under the given root bone.


lia.camera.getParentAttachmentNames(client)View Source

Purpose

Builds and caches a lookup of parent attachment names for the player model.

Realm

Client

Parameters

Player client The player model whose attachment names should be cached.

Returns

table A table keyed by attachment ID with lowercased attachment names.


lia.camera.isHeadAttachmentName(name)View Source

Purpose

Checks whether an attachment name appears to belong to head or face geometry.

Realm

Client

Parameters

string name The lowercased attachment name to inspect.

Returns

boolean True when the name matches a head, face, eye, mouth, or neck attachment.


lia.camera.isHeadwearModel(model)View Source

Purpose

Checks whether a model path appears to represent headwear or face-worn geometry.

Realm

Client

Parameters

string model The model path to inspect.

Returns

boolean True when the model path matches known headwear terms.


lia.camera.isHeadBodygroupName(name)View Source

Purpose

Checks whether a bodygroup name appears to control headwear or face geometry.

Realm

Client

Parameters

string name The bodygroup name to inspect.

Returns

boolean True when the bodygroup should be hidden for first-person body view.


lia.camera.setFirstPersonHeadBodygroupsHidden(client, hidden)View Source

Purpose

Hides or restores player bodygroups that contain headwear or face geometry.

Realm

Client

Parameters

Player client The player model whose bodygroups should be modified.

boolean hidden Whether matching bodygroups should be hidden or restored.


lia.camera.shouldHideFirstPersonChildEntity(client, entity)View Source

Purpose

Determines whether a child entity attached to the player should be hidden in first-person body view.

Realm

Client

Parameters

Player client The player whose attached entities are being inspected.

Entity entity The child entity being checked.

Returns

boolean True when the entity appears to be headwear, facewear, or nearby bonemerged head geometry.


lia.camera.setFirstPersonHeadwearHidden(client, hidden)View Source

Purpose

Hides or restores headwear entities parented to the player for first-person body view.

Realm

Client

Parameters

Player client The player whose child headwear entities should be modified.

boolean hidden Whether matching child entities should be hidden or restored.


lia.camera.setFirstPersonHeadHidden(client, hidden)View Source

Purpose

Hides or restores local first-person head, neck, head bodygroups, and headwear geometry.

Realm

Client

Parameters

Player client The player model to modify.

boolean hidden Whether head-related geometry should be hidden.


lia.camera.applyFreelookToAngles(client, angles)View Source

Purpose

Applies the current freelook offset to a camera angle when freelook is available.

Realm

Client

Parameters

Player client The local player using freelook.

Angle angles The base camera angles.

Returns

Angle The adjusted camera angles.


lia.camera.buildRealisticView(client, origin, angles, fov)View Source

Purpose

Builds a realistic first-person view from the player's eye attachment or eye position.

Realm

Client

Parameters

Player client The local player.

Vector origin The original view origin.

Angle angles The original view angles.

number fov The current field of view.

Returns

table|nil A CalcView-compatible view table when realistic view can be built.


lia.camera.buildFreelookBodyView(client, pos, ang, fov)View Source

Purpose

Builds a first-person body view while freelook is active or easing back to center.

Realm

Client

Parameters

Player client The local player.

Vector pos The original view position.

Angle ang The original view angles.

number fov The current field of view.

Returns

table|nil A CalcView-compatible view table when body rendering should be forced.


lia.camera.calcView(client, pos, ang, fov)View Source

Purpose

Builds the final Lilia camera view for third-person, realistic first-person, freelook body view, or the default first-person view.

Realm

Client

Parameters

Player client The player whose view is being calculated.

Vector pos The original view position.

Angle ang The original view angles.

number fov The current field of view.

Returns

table A CalcView-compatible table containing origin, angles, fov, and drawviewer when required.

Example Usage

  hook.Add("CalcView", "liaCameraCalcView", lia.camera.calcView)

Hooks

Library-specific hooks documented for this library.


FreelookToggled(enabled)View Source

Purpose

Runs after the freelook console command changes freelook state.

Realm

Client

Parameters

boolean enabled True when freelook was enabled, false when it was disabled.


PreFreelookToggle(enabled)View Source

Purpose

Runs before the freelook console command changes freelook state.

Realm

Client

Parameters

boolean enabled True when freelook is about to be enabled, false when it is about to be disabled.

Returns

boolean|nil Return false to block the freelook state change. Return nil or true to allow it.


ShouldDisableThirdperson(client)View Source

Purpose

Allows plugins or modules to disable the Lilia third-person camera override for a client.

Realm

Client

Parameters

Player client The player whose third-person camera availability is being checked.

Returns

boolean|nil Return true to block third-person view. Return nil or false to allow normal camera checks to continue.


ShouldUseFreelook(client)View Source

Purpose

Allows plugins or modules to prevent freelook input processing for the local player.

Realm

Client

Parameters

Player client The local player whose freelook availability is being checked.

Returns

boolean|nil Return false to block freelook input. Return nil or true to allow normal freelook checks to continue.


ThirdPersonToggled(enabled)View Source

Purpose

Runs after the F4 third-person toggle changes the third-person option.

Realm

Client

Parameters

boolean enabled True when third-person view was enabled, false when it was disabled.