Skip to content

Commit

Permalink
fix: custom raycast and spherecast return normal in local space
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Jun 26, 2024
1 parent ab047a9 commit 66d51ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ We provide multiple kits containing **themable pre-styled components**. Inspired

## Sponsors

This project is support by a few companies and individuals building cutting edge 3D Web & XR experiences. Check them out!
This project is supported by a few companies and individuals building cutting edge 3D Web & XR experiences. Check them out!

![Sponsors Overview](https://bbohlender.github.io/sponsors/screenshot.png)
8 changes: 2 additions & 6 deletions packages/uikit/src/panel/interaction-panel-mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export function makePanelSpherecast(mesh: Mesh): Exclude<Mesh['spherecast'], und
return
}

const normal = planeHelper.normal.clone()

for (let i = 0; i < 4; i++) {
const side = sides[i]
planeHelper.copy(side).applyMatrix4(matrixWorld)
Expand Down Expand Up @@ -81,7 +79,7 @@ export function makePanelSpherecast(mesh: Mesh): Exclude<Mesh['spherecast'], und
distancesHelper[0] / (distancesHelper[0] + distancesHelper[1]),
distancesHelper[3] / (distancesHelper[2] + distancesHelper[3]),
),
normal,
normal: new Vector3(0, 0, 1),
})
}
}
Expand All @@ -102,8 +100,6 @@ export function makePanelRaycast(mesh: Mesh): Mesh['raycast'] {
return
}

const normal = planeHelper.normal.clone()

for (let i = 0; i < 4; i++) {
const side = sides[i]
planeHelper.copy(side).applyMatrix4(matrixWorld)
Expand All @@ -120,7 +116,7 @@ export function makePanelRaycast(mesh: Mesh): Mesh['raycast'] {
distancesHelper[0] / (distancesHelper[0] + distancesHelper[1]),
distancesHelper[3] / (distancesHelper[2] + distancesHelper[3]),
),
normal,
normal: new Vector3(0, 0, 1),
})
}
}
Expand Down

0 comments on commit 66d51ca

Please sign in to comment.