Blend to a cutscene camera
Goal
Press C to blend to a placed camera; press B to blend back to the player. Start with the player setup from Place actors.
Files you will edit
src/game.ts
Steps
Add these imports, shared transition options and system:
tsimport { actors, CameraActor, setViewTargetWithBlend, spawnActor, type GameContext, type ViewTargetTransitionParams, } from 'gameable'; const transition: ViewTargetTransitionParams = { blendTime: 1.2, blendFunction: 'easeInOut', blendExp: 2, lockOutgoing: true, }; function cutsceneControls(ctx: GameContext): void { if (ctx.input.pressed('KeyC')) { const view = actors.named('cutscene'); if (view) setViewTargetWithBlend(ctx, 0, view, transition); } if (ctx.input.pressed('KeyB')) { setViewTargetWithBlend(ctx, 0, null, transition); } }Add this spawn to
defineGame.init(ctx)and appendcutsceneControlstosystems. Keep the existing player definition: it creates the seated controller that owns the manager. The camera looks down -Z from this position.tsspawnActor(ctx, CameraActor, { name: 'cutscene', position: { x: 0, y: 3, z: 8 }, props: { fov: 50 }, });Leave
activateOnStartfalse andautoActivateSeatat -1. Selection goes through the blend call.lockOutgoingfreezes the outgoing pose; false lets it keep moving. Call on the transition event, not every tick: repeated calls restart the blend. PassblendTime: 0for an immediate cut.
Verify
Run npm run dev in the game. Press C: the eye and FOV ease to the cutscene view over 1.2 seconds. Press B: the player view returns. Press B halfway through C's blend: the return starts from the currently visible pose.