The scene's BoxTree of the parts' and the sprites' world boxes.
The scene's mesh controller.
The scene's sprite controller.
The scene's cutting planes.
The scene's: its cache size read now, its line tolerance at each query.
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.
'sprite' in hit tells a sprite's. 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: copies when cached.
The camera the ray goes through: the sprites face it, its world matrices as last drawn; its projection gives the lines' threshold.
onlyFirst: only the first hit (default), the hit seen without a filter:
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). With a filter, the first hit it keeps: all the hits are
raycast, once for every filter of the same ray. viewportHeight: the view's height in
pixels, a line hit within settings.scene.lineThresholdPixels of it (default: only a line
crossed). filter: the hits kept (default: all).
Appends the parts and the sprites whose world box the ray crosses to target, then sorts it
nearest box first. The boxes only: the cutting planes are not applied (see intersect).
onlyFirst: only the one whose box the ray enters first (default).
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 (seeScene.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 last queries are cached (
settings.scene.raycastCacheSize): the same query again, e.g. of several plugins on one click, gives copies of the same hits without raycasting, until the objects or the cutting planes change. The filters apply after the cache: callers filtering differently share its hits.