Fix for raycasting inaccuracy - #166
Conversation
🦋 Changeset detectedLatest commit: 2286de8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 2286de8:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
RodrigoHamuy
commented
Jun 26, 2026
Thanks for the fix and the clear write-up! Would you mind just keeping it a bit more minimal. The helper and test add overhead for what is essentially a one-line change. Could you simplify to just: state.raycaster.ray.origin.set(state.pointer.x,state.pointer.y,-1).applyMatrix4(projViewInv);in |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
pichiste
commented
Jul 2, 2026
Hi @RodrigoHamuy, thanks for merging. I was wondering if you have an ETA when you might do a next release? |
RodrigoHamuy
commented
Jul 18, 2026
@pichiste should be available in 1.0.1. Sorry the delay! |
Solves #68
Fixes raycast inaccuracy, which was more pronounced when objects were towards the edge of the viewport. The problem was that the raycast origin did not take the cursor position into account.
Changes:
pointerXandpointerYcomputeRayhelpercompute-ray.test.ts) for this issueScreen Captures:
before.mp4
after.mp4