Documentation - v20.0.0-dev
    Preparing search index...

    Ray queries on the objects of a Scene, mesh parts and sprites: their world boxes through the scene's BoxTree (shared by both), then each part's triangles through its geometry's BVH (PartRaycaster), each sprite's image facing the camera (SpriteController.intersect). Synchronous. The BoxTree follows the changes a message later (see Scene.boxTree): the objects just added or moved are found once it has them.

    Only what the scene's cutting planes (CuttingPlanesController) keep is hit: on the part of the ray they keep (the boxes outside it not even entered), parts and sprites alike; whole, the objects ignoring them. The planes themselves are hit on the quads their CuttingPlanesHelper draws while it is shown: behind every object, as they are drawn.

    Nothing is cached: each query raycasts (the application caches its own, e.g. per event).

    Index

    Constructors

    Methods

    • The visible parts and sprites the ray hits, one hit each (a part's nearest triangle, or segment near enough for a part drawing lines, see options.viewportHeight; a sprite's image facing camera), what the cutting planes cut left out, appended to target sorted as seen: by layer drawn, the highest first (a layer is drawn over the lower ones, whatever their depth: a selected object with the selection overlay over the others), then nearest first; then the quads of the cutting planes shown, nearest first (drawn behind every object). The first hit is what the ray sees; choosing among them is the caller's. The hidden ones are left out. Builds the BVH of each geometry it raycasts, on its first raycast. The hits are the caller's.

      Parameters

      • ray: Ray
      • camera: Camera

        The camera the ray goes through: the sprites face it, its world matrices as last drawn; its projection gives the lines' threshold.

      • target: SceneHit[]
      • options: SceneRaycastOptions = {}

        onlyFirst: only the first hit (default), the hit seen among the objects kept: the parts and sprites are tested by layer, nearest box first, until the next box is in a lower layer than the best hit or starts farther than it; those that cannot give it are not raycast (nor their BVH built). viewportHeight: the view's height in pixels, a line hit within settings.scene.lineThresholdPixels of it (default: only a line crossed). transparent: whether the parts drawn transparent are hit (default). filter: the objects hit, the others skipped before their raycast (default: all).

      Returns SceneHit[]