logo

Babylon.js Market

ChaseCameraTarget

camera · space-combat-sim

ChaseCameraTarget

1
Unlock

Install with the CLI:

bjs download ChaseCameraTarget

ChaseCameraTarget

A one-entity marker that names the ship the 6-DOF chase camera follows.

What it does

ChaseCameraTarget owns no System and holds no data — it's a pure marker. The consumer is ChaseCamera6DOFSystem (declared by the ChaseCamera6DOF component on the camera entity), which queries [ChaseCameraTarget, Transform6DOF], finds the single marked entity, and each frame eases the camera toward a pose trailing behind-and-above that entity's Transform6DOF — in the ship's own local frame, so the camera banks and rolls with it. It exists because Wingman's old OriginAnchor meant two things at once ("the camera's subject" and "what the floating origin recenters on"); this marks only the first. Its sibling WorldOriginAnchor marks the second.

Use it in a scene

A scene is just data — a list of entities, each with its components. At startup the SceneLoader turns this JSON into a live world; edit the file and reload to rebuild it.

Build it from scratch with the bjs CLI:

  1. 1Scaffold a project
    npm create @babylonjsmarket/arcade@latest my-game

    World, renderer, and dev server — ready to run.

  2. 2Install dependencies
    cd my-game && npm install
  3. 3Add ChaseCameraTarget
    bjs download ChaseCameraTarget

    Copies its source into src/ so the scene resolves.

    First time? Run bjs login once.

  4. 4Paste the scene into src/scenes/arcade-room.ts and run
    npm run dev

    SceneLoader builds the world from the JSON; reload to rebuild.

JSON
{
  "Player": {
    "tags": ["player"],
    "components": {
      "Transform6DOF": { "x": 0, "y": 0, "z": 0 },
      "Renderable": { "shape": "spaceplane", "glbSrc": "/wingman/falconship.glb" },
      "ChaseCameraTarget": {}
    }
  }
}

Props

None. ChaseCameraTarget is a bare marker — {} is the only valid form, and serialize() returns {}. All the trailing geometry (distance, height, smoothing) lives on the ChaseCamera6DOF component on the camera entity, not here.

Events

  • Emits nothing.
  • Listens for nothing.

It's a passive marker: ChaseCamera6DOFSystem discovers it by query ([ChaseCameraTarget, Transform6DOF]), never through the bus, so there are no ChaseCameraTargetEvents / ChaseCameraTargetInputEvents to import.

Dependencies

Transform6DOF — the pose the camera trails. Without it the entity fails the camera system's query and the camera has nothing to follow. In practice the marked entity also carries a Renderable (so there's a ship to see) and, if it should fly, the full 6-DOF flight stack (Velocity6DOF + FlightIntent + ShipFlight) plus input (PlayerFlightInput).

Notes

  • Mark exactly one entity. The camera system follows the first match; a second ChaseCameraTarget in the scene is ambiguous and only one wins.
  • It's paired with, but distinct from, WorldOriginAnchor. Both usually sit on the player ship, but they answer different questions — "what does the camera watch" vs. "what does the floating origin recenter on" — so keep both if you use a floating origin.
  • The camera itself needs CameraState6DOF (the 6-DOF camera pose) plus ChaseCamera6DOF (the trailing smoother that consumes this marker). Without that system in the scene the marker does nothing on its own.
  • No renderer coupling: the component is pure data with zero @babylonjs/three imports, so it rides on whichever adapter the game booted.

More like this

Transform6DOF
ArcCamera
Asteroid
CameraFollow
CameraState6DOF
ChaseCamera6DOF
FlightIntent
FreighterCar
FreighterChain
FreighterHead
GameConfig
OilBlob
PinballCamera
PlayerFlightInput
Renderable
ShipFlight
ShooterCamera
SpaceDust
SpaceShooterBullet
SpaceShooterHealth
SpaceShooterScore
Velocity6DOF
WaveDirector
Waypoint
WaypointTrack
WorldOriginAnchor

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search