OptionalautoWhen true, update() runs one cellular-automaton tick before
the renderer/physics flush. Default false for back-compat —
v1.x users get the same behavior they had. Enable when any
registered material has simulation: 'sand' (or other future
fluid kinds) so the bitmap is stepped automatically each frame.
The simulation tick is O(width × height) per call. For very
large bitmaps without fluid materials in flight, leaving this
false and calling terrain.simStep() manually only when you
know fluid pixels exist is a worthwhile optimization.
OptionalchunkEdge length of each chunk in pixels. Default 64.
World height in pixels. Must be divisible by chunkSize.
OptionalmaterialsMaterials to register up-front.
OptionalonCalled once per dynamic debris body the queue creates during a flush. The handler receives the body id, the bitmap-space outer contour the body was built from, and the material used for its physical properties. Use this to spawn a sprite or graphics for the debris.
Body lifetime is the caller's responsibility — debris bodies are not destroyed by the terrain itself.
OptionalpixelsPixels per Box2D meter. Defaults to 32 (Phaser Box2D convention).
OptionalsimplificationDouglas-Peucker simplification epsilon for collider contours. Default 1.
World width in pixels. Must be divisible by chunkSize.
OptionalworldBox2D world to attach colliders to. Optional — terrain works
purely visually if you don't need physics. When provided, the
terrain manages chunk collider lifecycle internally; carve /
deposit calls dirty chunks and the next update() flushes the
deferred queue.
OptionalxWhere to place the terrain's top-left in scene coordinates. Defaults to (0, 0).
OptionalyScene Y offset.
Construction options for DestructibleTerrain.