Interface Box2DAdapterOptions

interface Box2DAdapterOptions {
    defaultTerrainFriction?: number;
    defaultTerrainRestitution?: number;
    originPx?: {
        x: number;
        y: number;
    };
    pixelsPerMeter?: number;
    worldId: {
        __brand: "WorldId";
    };
}

Properties

defaultTerrainFriction?: number

Default friction for terrain chain shapes (overridable per material).

defaultTerrainRestitution?: number

Default restitution for terrain chain shapes.

originPx?: {
    x: number;
    y: number;
}

Scene-space pixel offset to apply to every body the adapter creates. The chunk's static body is placed here; debris bodies have this offset added to their pixel-space centroid before conversion to meters.

Use this when the rendered terrain is not at scene origin (0, 0) — e.g. a centered terrain at scene (104, 52) should pass originPx: { x: 104, y: 52 } so that body positions map back to scene coordinates correctly.

Default: { x: 0, y: 0 }.

pixelsPerMeter?: number

Pixel-to-meter conversion factor. Default is 32 (Phaser Box2D convention).

worldId: {
    __brand: "WorldId";
}

The Box2D world this adapter creates bodies in.