DeviceOrientationControls undefined camera #587
ChrisDesigns
started this conversation in
General
Replies: 1 comment 2 replies
-
The camera is actually defined in your example. The problem lies in how you are instantiating the component in the scene graph. Perhaps the documentation could be updated to be more clear. 🤔 If you make this change, it should work. extend({ DeviceOrientationControlsImp })
const DeviceOrientationControls = forwardRef((props, ref) => {
const { camera } = useThree()
const controls = useRef()
useFrame(() => controls.current && controls.current.update())
useEffect(() => {
controls.current.connect()
return () => controls.current && controls.current.dispose()
})
- return <DeviceOrientationControlsImp ref={mergeRefs([controls, ref])} args={[camera]} {...props} />
+ return <deviceOrientationControlsImp ref={mergeRefs([controls, ref])} args={[camera]} {...props} />
}) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been trying to write an implementation for DeviceOrientationControls for drei as it does not have it implementation. When trying to construct DeviceOrientationControls, the camera object from the useThree hook returns undefined. I've tried to drilling-down the camera from canvas as prop with no luck. I've created a codesandbox example to showcase this problem. Does anyone have an idea of why it is returning undefined?
Beta Was this translation helpful? Give feedback.
All reactions