Small World Engine API Reference - v0.78.00
    Preparing search index...

    Class AbstractShowcaseAbstract

    Base class for applications built with the SmallWorld engine.

    Hierarchy (View Summary)

    Index
    camera: Camera

    The main camera.

    canvas: HTMLCanvasElement

    The canvas element.

    The engine configuration.

    debug: boolean = false

    Whether debug visualization is enabled.

    defaultCameraController: "none" | "fly" | "orbit" = "fly"

    The default camera controller attached if none is manually registered in setupScene(). 'fly' (default): 6-DOF spectator FlyCam (WASD + QE/Space/C + mouse look + Shift boost + Alt slow). 'orbit': Turntable OrbitController around target. 'none': No camera controller automatically attached.

    defaultFlyCollision: boolean = false

    Whether collisions with scene geometry are enabled for the default FlyController. Defaults to false (noclip).

    defaultMoveSpeed: number = 7.0

    Base flight speed when using the default FlyController. Defaults to 7.0 units/sec.

    events: EventDispatcherImpl = ...

    The global event bus for this engine instance.

    input: Input = ...
    interactionManager: InteractionManager

    The interaction manager for gamification / picking.

    physics: PhysicsSystem

    The built-in physics system. Stepped automatically each frame when config.enablePhysics is true.

    renderer: Renderer

    The active renderer.

    scene: Scene

    The current scene.

    • A hook method that is called when the canvas element is recreated. By default, it binds the click event to request PointerLock. Inheriting classes can override this if needed.

      Returns void

    • Central keyboard control for all showcasess. Inheriting classes can override this method and call super.onKeyDown(event).

      Parameters

      • event: KeyboardEvent

      Returns void

    • Resets the camera to its initial/reference position and orientation. Can be invoked manually or triggered via the 'R' key.

      Returns void

    • Sets the initial/reference camera position and target for this showcase. Immediately synchronizes position, target, spherical theta/phi angles and view matrix. Calling this ensures pressing 'R' returns exactly to this perspective.

      Parameters

      Returns void

    • Briefly slows down gameplay (app update, physics, scene behaviors) to sell the impact of a hit, while the camera and its effects (e.g. shake) keep running in real time. Rendering and input are unaffected. Global, not per-entity -- see docs/adr/0003-hit-stop-is-global-not-per-entity.md.

      Parameters

      • duration: number

        Real-time seconds the slowdown lasts.

      • timeScale: number = 0.05

        Multiplier applied to deltaTime for gameplay systems while active. Default 0.05 (near-freeze).

      Returns void

    • Default update method for examples. Subclasses can override this to implement custom logic.

      Parameters

      • _deltaTime: number

        Time elapsed since the last frame.

      Returns void

    • Helper to wait for all currently loading assets to finish. Useful to call at the end of setupScene.

      Returns Promise<void>