Bitbybit Docs
    Preparing search index...

    Class BabylonCamera

    Cameras of the BabylonJS scene: arcRotate orbits a target and is the usual choice for looking at a model, free flies with keyboard and pointer, target looks at a point without user control. The methods here set a camera's position, target, speed and clipping distances and switch it between perspective and orthographic projection.

    Index

    Constructors

    Properties

    adjust

    • Stops a camera from recomputing its projection every frame, saving work when its field of view and clipping distances no longer change.

      Parameters

      Returns void

    • Lets a frozen camera recompute its projection again, needed after changing its field of view or clipping distances.

      Parameters

      Returns void

    • Switches a camera to orthographic projection, where objects keep their size whatever their distance, as in technical drawings.

      The four ortho values are the edges of the view in scene units; a 0 falls back to the default of 1 unit each way.

      Parameters

      • inputs: OrthographicDto

        The camera and the four edges of the orthographic view

      Returns void

      bitbybit.babylon.camera.makeCameraOrthographic({ camera, orthoLeft: -20, orthoRight: 20, orthoBottom: -10, orthoTop: 10 });
      
    • Switches a camera back to perspective projection, where distant objects look smaller, the default for cameras.

      Parameters

      Returns void

    get

    • Reads where a camera is in the scene, as a point.

      Parameters

      Returns Point3

      The position as a point

    • Reads the point a camera is looking at.

      Parameters

      Returns Point3

      The target as a point

    • Reads how fast a camera moves in response to its controls.

      Parameters

      Returns number

      The speed

    set

    • Moves a camera to a point in the scene; a target camera keeps looking at its target from there.

      Parameters

      Returns void

      bitbybit.babylon.camera.setPosition({ camera, position: [20, 20, 20] });
      
    • Turns a camera to look at a point in the scene.

      Parameters

      • inputs: TargetDto

        The camera and the target point

      Returns void

      bitbybit.babylon.camera.setTarget({ camera, target: [0, 5, 0] });
      
    • Sets how fast a camera moves in response to its keyboard and pointer controls; 1 is the default pace.

      Parameters

      • inputs: SpeedDto

        The camera and the speed

      Returns void

    • Sets the near clipping distance of a camera: anything closer than minZ scene units is not drawn. Too small a value costs depth precision on large scenes.

      Parameters

      • inputs: MinZDto

        The camera and the near distance

      Returns void

    • Sets the far clipping distance of a camera: anything farther than maxZ scene units is not drawn.

      Parameters

      • inputs: MaxZDto

        The camera and the far distance

      Returns void