Compare commits
1 Commits
mimo/creat
...
mimo/code/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c3d9952d7 |
8
app.js
8
app.js
@@ -1919,10 +1919,12 @@ function setupControls() {
|
||||
);
|
||||
const raycaster = new THREE.Raycaster();
|
||||
raycaster.setFromCamera(mouse, camera);
|
||||
const intersects = raycaster.intersectObjects(portals.map(p => p.ring));
|
||||
// Raycast against both ring and swirl for a larger click target
|
||||
const portalMeshes = portals.flatMap(p => [p.ring, p.swirl]);
|
||||
const intersects = raycaster.intersectObjects(portalMeshes);
|
||||
if (intersects.length > 0) {
|
||||
const clickedRing = intersects[0].object;
|
||||
const portal = portals.find(p => p.ring === clickedRing);
|
||||
const hitObj = intersects[0].object;
|
||||
const portal = portals.find(p => p.ring === hitObj || p.swirl === hitObj);
|
||||
if (portal) activatePortal(portal);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user