Class: Raycaster
Static class that provides raycasting functionality
Hierarchy
- Raycaster
Index
Properties
Methods
Properties
Static camera
▪ camera: Camera | null
Defined in src/input/processing/Raycaster.ts:14
Methods
Static calculateRay
▸ calculateRay(event: any, canvas: HTMLCanvasElement, camera: Camera): Vector3‹›
Defined in src/input/processing/Raycaster.ts:90
Determines a virtual ray that a screen space interaction casts
memberof interactionHelper
Parameters:
| Name | Type | Description |
|---|---|---|
event |
any | - |
canvas |
HTMLCanvasElement | the canvas that is being used |
camera |
Camera | the camera that is being used |
Returns: Vector3‹›
a normalized three vector {x, y, z}
Static getIntersectionsWithRay
▸ getIntersectionsWithRay(rayOrigin: Vector3, rayDirection: Vector3, objects: Object3D[], near: number, far: number, backAndForth: boolean, recursive: boolean): Intersection[]
Defined in src/input/processing/Raycaster.ts:27
Determines the intersections between a ray and an array of objects
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
rayOrigin |
Vector3 | - | position of the ray origin |
rayDirection |
Vector3 | - | direction vector of the ray |
objects |
Object3D[] | - | the three nodes which take part in ray casting |
near |
number | 0 | the near clipping distance, defaults to 0 |
far |
number | Infinity | the far clipping distance, defaults to Infinity |
backAndForth |
boolean | false | whether the raycast should be done in both directions, defaults to false |
recursive |
boolean | true | whether objects should be traversed recursively, defaults to true |
Returns: Intersection[]
an array of intersections
Static getWorkplaneIntersectionWithRay
▸ getWorkplaneIntersectionWithRay(rayOrigin: Vector3, rayDirection: Vector3): Vector3‹›
Defined in src/input/processing/Raycaster.ts:70
Determines the intersection of the event with the z = 0 workplane
Parameters:
| Name | Type | Description |
|---|---|---|
rayOrigin |
Vector3 | position of the ray origin |
rayDirection |
Vector3 | direction vector of the ray |
Returns: Vector3‹›
the intersection point
Static projectWorldToCanvas
▸ projectWorldToCanvas(worldPosition: any, width: any, height: any, camera: any): Vector2‹›
Defined in src/input/processing/Raycaster.ts:109
Determines the canvas coordinates of a world position when rendered with the given camera
Parameters:
| Name | Type |
|---|---|
worldPosition |
any |
width |
any |
height |
any |
camera |
any |
Returns: Vector2‹›
the projected coordinates on the canvas