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

definePhysics

definePhysics(options): PhysicsSettings

Declares a game’s physics scene: its gravity, its solver’s passes and the height below which a falling body is destroyed. Export it from src/game.ts as physics, pass it to <Game physics>, and re-export it from the room’s scene file beside the plugins, as export { plugins, physics } from "../game": a page and its room compare it at the welcome. Each setting left out takes its default, and a game that declares nothing steps with every default. Throws on a setting no scene can step with, naming it.

Parameter Type
options PhysicsOptions

PhysicsSettings

export const physics = definePhysics({ gravity: [0, -20, 0] });