@twinfinity/core
    Preparing search index...

    Class DistanceToCamera

    Tracks distance of objects relative a camera.

    Call trackDistanceToCamera for each visible mesh, then read minDistanceToCamera to get the result. Call endFrame before each frame.

    Index

    Constructors

    Accessors

    • get minDistanceToCamera(): number

      The calculated minimum distance from the closest tracked mesh to the camera, divided by the distance divisor and clamped between ViewerCamera.cameraMinZ and the max near plane distance. Resets when beginFrame is called.

      Returns number

    Methods

    • Starts tracking distances for a new frame.

      Returns void

    • Tracks a mesh's distance to the camera.

      Updates the internal minimum distance if this mesh is closer than previously tracked meshes.

      Parameters

      Returns number

      The distance from the mesh to the camera