Constructor
new Raycaster(origin, direction)
Constructs a new raycaster.
Members
ray :Ray
The ray used for raycasting.
Methods
intersectObject(object, recursiveopt, intersectsopt) → {Array.<object>}
Checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first. An array of intersections is returned: [ { distance, point, face, faceIndex, object, uv }, ... ]
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
object | Object3D | — The 3D object to check for intersection with the ray. | ||
recursive | boolean | <optional> | false | — If set to |
intersects | Array.<object> | <optional> | [] | The target array that holds the result of the method. |
An array holding the intersection points.
- Type:
- Array.<object>
intersectObjects(objects, recursiveopt, intersectsopt) → {Array.<object>}
Checks all intersection between the ray and the objects with or without the descendants. Intersections are returned sorted by distance, closest first. An array of intersections is returned: [ { distance, point, face, faceIndex, object, uv }, ... ]
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
objects | Array.<Object3D> | — The 3D objects to check for intersection with the ray. | ||
recursive | boolean | <optional> | false | — If set to |
intersects | Array.<object> | <optional> | [] | The target array that holds the result of the method. |
An array holding the intersection points.
- Type:
- Array.<object>
set(origin, direction)
Updates the ray with a new origin and direction by copying the values from the arguments.
Name | Type | Description |
---|---|---|
origin | Vector3 | — The origin vector where the ray casts from. |
direction | Vector3 | — The (normalized) direction vector that gives direction to the ray. |
setFromCamera(coords, camera)
Uses the given coordinates and camera to compute a new origin and direction for the internal ray.