Log inGet started
World

First Light: Vagant

Branchmain
Branchesmain
Commit2ac9266a40

README.md

VagantCamera

The frame the vagant is seen in. It sits on the Vagant PlayerPrototype's CameraRig, beside the Camera, the AudioListener and the controller.third_person_follow rig, and it does three things.

It frames for the screen that is actually there. Every framing number comes out of fl.cameraFit() and the live ui.screenSize(), re-read whenever the viewport changes shape. A tall frame comes in closer, cranes higher and puts the vagant near the middle; a wide one pulls back and sets them off one shoulder. Nothing in it is a pixel or a constant chosen for one aspect. Three constants re-base fl's numbers into this rig's frame, which is not the frame fl states them in: third_person_follow measures shoulderOffset in the CAMERA's own axes rather than in world up, so fl's height is a lift up the SCREEN here.

It hands the rig the game's own controls. look carries a mouse delta, a right stick and a right-side drag at once, so putting the game's .inputMap in the rig's slot is the whole of making the camera aimable from all three device families. The rig subscribes to that slot once, in its own awake and never again, which is why this component declares executionOrder = -120 — before the rig's -90, so the map is in the slot before the subscription is made.

It answers the state of the night. The wig closes the view down (the camera comes in and drops while fl.isHidden()), and being hunted unsettles the frame by a drift that grows with fl.state.hunted and stops the moment they lose you.

The staging slice is the only other thing allowed to move the gameplay camera. This component stands down by itself while the phase is one staging owns (opening, won, lost), and :release() / :resume() say so explicitly.

Public fields

  • gameMap: AssetRef<inputMap> — the controls the rig is aimed with. Defaults to the game's own vagant map.
  • huntShake: number — how hard the frame answers a hunt; 0 turns it off.

Methods

  • :release() — stop driving the camera. staging calls this before taking the gameplay camera for a scripted beat.
  • :resume() — take it back and re-frame for the live screen.

Lifecycle

  • awake() — resolves the follow rig and the Camera, applies the framing, puts the game's map in the rig's slot, and publishes itself as fl.state.cameraRig.
  • start() — the same, for the case where the rig had not attached yet.
  • update(dt) / editorUpdate(dt) — re-frames on a screen resize or a wig change, and drives the hunt shake.

Usage

local rig = layers.active.players.localPlayer.avatar.parent.getChildren()
entity.find("CameraRig").component.get("VagantCamera"):release()