Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: configure camera for raycaster #3056

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/fiber/src/core/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@
if (!state.camera && !cameraOptions?.rotation) camera.lookAt(0, 0, 0)
}
state.set({ camera })

// Configure raycaster
// https://github.com/pmndrs/react-xr/issues/300
raycaster.camera = camera
}

// Set up scene (one time only!)
Expand Down Expand Up @@ -514,7 +518,7 @@
...rest,
} as RootState
},
[state],

Check warning on line 521 in packages/fiber/src/core/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test

React Hook React.useCallback has missing dependencies: 'container', 'events', 'pointer', 'previousRoot', 'raycaster', 'rest', and 'size'. Either include them or remove the dependency array
)

const [usePortalStore] = React.useState(() => {
Expand Down Expand Up @@ -547,11 +551,11 @@
unsub()
usePortalStore.destroy()
}
}, [])

Check warning on line 554 in packages/fiber/src/core/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test

React Hook React.useEffect has missing dependencies: 'inject', 'previousRoot', and 'usePortalStore'. Either include them or remove the dependency array

React.useEffect(() => {
usePortalStore.setState((injectState) => inject(previousRoot.getState(), injectState))
}, [inject])

Check warning on line 558 in packages/fiber/src/core/index.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test

React Hook React.useEffect has missing dependencies: 'previousRoot' and 'usePortalStore'. Either include them or remove the dependency array

return (
<>
Expand Down