threejs-worldgen
    Preparing search index...

    Class SurfaceControls

    Camera controls that work at every scale, on flat worlds and planets: orbit around a focus point that stays on the ground, exponential zoom from centimetres to orbit, pan/WASD at a speed proportional to the distance, the camera's "up" always the local up, and automatic near/far planes. The focus point is also the floating origin: the camera is placed in render space relative to it, so pass SurfaceControls.origin to terrain, water and anything else that uses a floating origin.

    Index
    altitude: number = 0

    Camera altitude above the ground under it, metres (updated every frame).

    azimuth: number = 0.6

    Horizontal view angle, radians.

    camera: PerspectiveCamera

    The controlled camera.

    distance: number

    Distance from the focus to the camera, metres.

    dom: HTMLElement

    Element that receives pointer and wheel input.

    elevation: number = 0.45

    Angle above the horizon, radians.

    focus: Vec3

    Planet-centred (or flat-world) focus point on the ground, float64. Render-space zero.

    Settings.

    world: World

    The world the camera moves over.

    • Jumps to look at focus from distance metres.

      Parameters

      • focus: Vec3
      • distance: number = ...

      Returns this