Implements

Constructors

Properties

cam?: null | Camera

The camera to use for the raycaster

layerMask?: number | Layers

raw layer mask, use setLayer to set an individual layer active

lineThreshold?: number
maxDistance?: number

Set the raycaster far distance:
The far factor of the raycaster. This value indicates which objects can be discarded based on the distance. This value shouldn't be negative and should be larger than the near property.

minDistance?: number

Set the raycaster near distance:
The near factor of the raycaster. This value indicates which objects can be discarded based on the distance. This value shouldn't be negative and should be smaller than the far property.

ray?: Ray

Optional ray that can be used for raycasting

raycaster?: Raycaster

Optionally a custom raycaster can be provided. Other properties will then be set on this raycaster

recursive?: boolean = true

If true, the raycaster will traverse the scene recursively.

true
results?: Intersection<Object3D<Object3DEventMap>>[]

Raycast results array. You can provide an array here to avoid creating a new one (note that if your array already contains items they will be removed)

screenPoint?: Vector2

Point on screen in raycast space / normalized device coordinates (-1 to 1).

targets?: Object3D<Object3DEventMap>[]

Objects to raycast against. If no target array is provided the whole scene will be raycasted

testObject?: RaycastTestObjectCallback

Optional calback function to be called per object before tested for intersections.
This can be used to filter objects.
Return false to ignore the object completely or "continue in children" to skip the object but continue to traverse its children (if you do raycast with recursive enabled)

useAcceleratedRaycast?: boolean

Use MeshBVH for raycasting. This is faster than the default threejs raycaster but uses more memory.

undefined

Methods

  • Parameters

    • ox: number
    • oy: number

    Returns void

  • sets one layer for raycasting (e.g. layer 4, only objects on layer 4 will then be hit)

    Parameters

    • layer: number

    Returns void

  • sets the layer.mask value directly, use setLayer if you want to set e.g. an individual layer only active. See https://threejs.org/docs/#api/en/core/Layers for more information about layers

    Parameters

    • mask: number

    Returns void