Skip to content

Commit

Permalink
feat: ScreenSpace abstraction added
Browse files Browse the repository at this point in the history
  • Loading branch information
antokhio committed Nov 2, 2022
1 parent 4d4deb7 commit 34c99a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/ScreenSpace.tsx
Expand Up @@ -8,11 +8,11 @@ export type ScreenSpaceProps = {
} & JSX.IntrinsicElements['group']

export const ScreenSpace = React.forwardRef<Group, ScreenSpaceProps>(({ children, depth = -1, ...rest }, ref) => {
const localRef = React.useRef<Group>(null)
const localRef = React.useRef<Group>(null!)

useFrame(({ camera }) => {
localRef.current?.quaternion.copy(camera.quaternion)
localRef.current?.position.copy(camera.position)
localRef.current.quaternion.copy(camera.quaternion)
localRef.current.position.copy(camera.position)
})
return (
<group ref={mergeRefs([ref, localRef])} {...rest}>
Expand Down

0 comments on commit 34c99a3

Please sign in to comment.