Camera¶
Camera helpers for Lilia third-person view, realistic first-person view, freelook input, and local-player visibility handling.
Overview
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
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
lia.camera.canUseFreelook(client)View Source
lia.camera.isInSights(client)View Source
lia.camera.isHoldingFreelookBind(client)View Source
lia.camera.resetFreelookState()View Source
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
lia.camera.shouldDrawBodyForFreelook(client)View Source
lia.camera.getFirstPersonHeadBones(client)View Source
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
lia.camera.isHeadAttachmentName(name)View Source
lia.camera.isHeadwearModel(model)View Source
lia.camera.isHeadBodygroupName(name)View Source
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.applyFreelookToAngles(client, angles)View Source
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.