matrix-engine-wgpu 1.4.6 → 1.4.7
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/package.json +1 -1
- package/src/engine/raycast.js +11 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matrix-engine-wgpu",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"description": "Fixed shadows casting vs camera/video texture, webGPU powered pwa application. Crazy fast rendering with AmmoJS physics support. Simple raycaster hit object added.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/src/engine/raycast.js
CHANGED
|
@@ -231,16 +231,17 @@ export function addRaycastsAABBListener(canvasId = "canvas1") {
|
|
|
231
231
|
const {rayOrigin, rayDirection} = getRayFromMouse2(event, canvasDom, camera);
|
|
232
232
|
for(const object of app.mainRenderBundle) {
|
|
233
233
|
const {boxMin, boxMax} = computeWorldVertsAndAABB(object);
|
|
234
|
-
if(object.raycast.enabled ==
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
234
|
+
if(object.raycast.enabled == true) {
|
|
235
|
+
if(rayIntersectsAABB(rayOrigin, rayDirection, boxMin, boxMax)) {
|
|
236
|
+
// console.log('AABB hit:', object.name);
|
|
237
|
+
canvasDom.dispatchEvent(new CustomEvent('ray.hit.event', {
|
|
238
|
+
detail: {hitObject: object},
|
|
239
|
+
rayOrigin: rayOrigin,
|
|
240
|
+
rayDirection: rayDirection
|
|
241
|
+
}));
|
|
242
|
+
if(touchCoordinate.stopOnFirstDetectedHit == true) {
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
247
|
}
|