First Light: Luteway
README.md
FollowCam — the camera of the Luteway
The one camera in First Light: Luteway, and the lens every staged moment
borrows. Orthographic, side-on, never rotating, never leaving the
LW.CAMERA.z plane. It sits on the scene's CameraRig as the Camera
component's behavior.
The frame
The lens fixes the height: LW.CAMERA.orthoHeight world units, at every
aspect. So a phone held upright sees a narrow tall slice of cliff and a wide
monitor sees the same height with more cliff either side, and the climb reads
the same on both. Nothing here is a pixel — the only thing the screen's shape
decides is how much cliff stands beside the climb, which is recomputed from
the live ui.screenSize() every frame.
Two rules keep that honest at the extremes:
- Narrow. When the frame is narrower than the cliff it clamps to the level and the horizontal deadzone starts doing work; when it is wider, the climb is centred and the frame stops moving sideways at all.
- Wide. A frame wide enough to see past the dressed cliff
(
LW.CAMERA.dressHalfWidth, ±15 units — the contract with the cliff slice) closes the lens until it cannot, down toLW.CAMERA.minHeight. A 21:9 screen therefore sees 30 units across and 12.8 up, not 15 units of nothing.
The follow
It tracks LW.state.player — the blackboard, not an entity, because the climb
slice runs its own 2D sim. A horizontal deadzone the penguin moves inside
freely, a lead in the direction it is sidling, an upward lead so the next ledge
is always in shot, a look further ahead into a long fall, and a softer vertical
time constant so a landing reads as weight.
A landing puts its weight into the frame: the shot dips in proportion to
the speed it landed at and eases back, and past LW.CAMERA.kickAt it kicks
as well. landingWeight scales both; 0 turns them off.
The frame never looks under the water. The sea line may sit at most
LW.CAMERA.seaFloor units above the bottom of the frame, so as the tide takes
the beach the shot is pushed up ahead of it and the penguin sinks toward the
bottom of the screen — which is the picture that moment wants.
Where it ended up is published into LW.state.camera — x, y,
orthoHeight, halfWidth, and staged (true while a moment holds the frame).
The shot API
| Call | What it does |
|---|---|
:panTo(x, y, seconds, ease) | a TIMED move along an eased curve; :isPanning() says when it arrives |
:zoomTo(height, seconds, ease) | a TIMED change of lens. 16 is the playing frame, 9.5 a push, 26 the cliff opening out |
:driveTo(x, y) | the untimed, damped drive |
:snapTo(x, y) | a cut |
:setDrift(vx, vy) | a slow creep added to a driven shot — a held frame that drifts is alive |
:kick(amount) / :settle(amount) | the shake, and the weight of a landing |
:release() | hand the shot back to the penguin |
:pose() / :lens() / :frame() | where the shot is, how much it covers, and the world rectangle it covers |
:frameAt(aspect) | the rectangle it would settle to on a screen of that shape |
Ease names: linear inQuad outQuad inOutQuad outCubic inOutCubic
inOutSine outExpo.
Staging.component is the only thing that drives these in the finished game.
:frameAt() is how any slice asks what a phone, a laptop and a television each
see of the same moment without changing the screen.
In edit mode
It poses in edit as well as in play, so authoring against the scene shows the game's frame, and a staged moment can be rehearsed without entering play and locking the VFS for the other slices.
Usage
rig.component.add("Camera", {
projection = "orthographic",
orthoHeight = LW.CAMERA.orthoHeight,
behavior = asset.resolve("luteway.camera.FollowCam", "component"),
})
Owned by the camera slice. Tuning lives in LW.CAMERA in luteway.game.