@thatopen/components 2.4.0-alpha.8 → 2.4.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Raycasters/src/simple-raycaster.d.ts +3 -1
- package/dist/index.cjs +4 -2
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.mjs +4 -2
- package/dist/namespace.d.ts +3790 -3788
- package/package.json +1 -1
|
@@ -35,8 +35,10 @@ export declare class SimpleRaycaster implements Disposable {
|
|
|
35
35
|
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
36
36
|
* to query. If not provided, it will query all the meshes stored in
|
|
37
37
|
* {@link Components.meshes}.
|
|
38
|
+
* @param position - the screen position to use for raycasting. If not provided,
|
|
39
|
+
* the last pointer (mouse/touch) position will be used.
|
|
38
40
|
*/
|
|
39
|
-
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
41
|
+
castRay(items?: THREE.Object3D[], position?: THREE.Vector2): THREE.Intersection | null;
|
|
40
42
|
/**
|
|
41
43
|
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
42
44
|
* This method also takes into account the clipping planes used by the renderer.
|
package/dist/index.cjs
CHANGED
|
@@ -9554,13 +9554,15 @@ class SimpleRaycaster {
|
|
|
9554
9554
|
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
9555
9555
|
* to query. If not provided, it will query all the meshes stored in
|
|
9556
9556
|
* {@link Components.meshes}.
|
|
9557
|
+
* @param position - the screen position to use for raycasting. If not provided,
|
|
9558
|
+
* the last pointer (mouse/touch) position will be used.
|
|
9557
9559
|
*/
|
|
9558
|
-
castRay(items = Array.from(this.world.meshes)) {
|
|
9560
|
+
castRay(items = Array.from(this.world.meshes), position = this.mouse.position) {
|
|
9559
9561
|
if (!this.world) {
|
|
9560
9562
|
throw new Error("A world is needed to cast rays!");
|
|
9561
9563
|
}
|
|
9562
9564
|
const camera = this.world.camera.three;
|
|
9563
|
-
this.three.setFromCamera(
|
|
9565
|
+
this.three.setFromCamera(position, camera);
|
|
9564
9566
|
return this.intersect(items);
|
|
9565
9567
|
}
|
|
9566
9568
|
/**
|