Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/threejs_4_deno/src/core/Raycaster.js>Raycaster

A simple transformation of three.js for use within a Deno workflow
Go to Latest
class Raycaster
import { Raycaster } from "https://deno.land/x/threejs_4_deno@v121/src/core/Raycaster.js";

Constructors

new
Raycaster(
origin?: Vector3,
direction?: Vector3,
near?: number,
far?: number,
)

This creates a new raycaster object.

Properties

camera: Camera

The camera to use when raycasting against view-dependent objects such as billboarded objects like Sprites. This field can be set manually or is set when calling "setFromCamera".

far: number

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.

layers: Layers

Used by Raycaster to selectively ignore 3D objects when performing intersection tests.

near: number

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

The Ray used for the raycasting.

Methods

intersectObject(
object: Object3D,
recursive?: boolean,
optionalTarget?: Intersection[],
): Intersection[]

Checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first.

intersectObjects(
objects: Object3D[],
recursive?: boolean,
optionalTarget?: Intersection[],
): Intersection[]

Checks all intersection between the ray and the objects with or without the descendants. Intersections are returned sorted by distance, closest first. Intersections are of the same form as those returned by .intersectObject.

set(origin: Vector3, direction: Vector3): void

Updates the ray with a new origin and direction.

setFromCamera(coords: { x: number; y: number; }, camera: Camera): void

Updates the ray with a new origin and direction.