Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

Frame2DTrait

const Frame2DTrait: Trait<{ pixelSnap: boolean; pixelsPerMetre: number; plane: Plane2D; }>

The scene’s 2D frame: the plane every sprite and tile layer reads, the pixels per metre every sheet and tile set must match, and whether they snap to its texels. Camera2D adds it to the world from its logic, outside Views, for as long as it is mounted, so a room holds it for its tile colliders and a devtools camera taking the view over leaves it. A world without it has no 2D camera: a sprite faces the 3D camera and nothing is checked. Read it with useTrait, so a reader mounted before the camera follows it.