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

    Class Camera

    Standard implementation of the CameraInterfaceData.

    Implements

    Index

    Constructors

    Properties

    behaviors: Behavior[] = []

    The behaviors attached to this camera.

    pendingDx: number = 0

    Horizontal rotation delta accumulated by behaviors.

    pendingDy: number = 0

    Vertical rotation delta accumulated by behaviors.

    phi: number = 0

    The rotation angle around the X-axis (pitch).

    position: Vector3D = ...

    The position of the camera in world space.

    target: Vector3D = ...

    The target point the camera is looking at.

    theta: number = 0

    The rotation angle around the Y-axis (yaw).

    up: Vector3D = ...

    The up vector of the camera (usually 0, 1, 0).

    Accessors

    Methods

    • Maps screen coordinates (NDC -1 to 1) to world coordinates on the Y=0 plane.

      Parameters

      • screenX: number

        Normalized X coordinate (-1 to 1).

      • screenY: number

        Normalized Y coordinate (-1 to 1).

      Returns Vector3D

      The world position on the Y=0 plane.

    • Performs the movement and logic of the active strategy.

      Parameters

      • targetPos: Vector3D

        The target position to follow.

      • dx: number

        The horizontal rotation delta.

      • dy: number

        The vertical rotation delta.

      • deltaTime: number = 0.016

        Elapsed time since the last frame.

      Returns void

    • Adjusts the zoom level (radius, FOV, or orthographic bounds).

      Parameters

      • delta: number

        The zoom delta.

      Returns void