Debug camera (react-three/drei) #494
-
Hi, I'm trying to debug my camera (position, etc.). I'm using react/three-drei and in my scene. When changing the position in the debug UI, it does not change the camera in the scene. Here is the code: any help is appreciated. thanks |
Beta Was this translation helpful? Give feedback.
Answered by
Remi-Tribia
Aug 20, 2024
Replies: 1 comment 1 reply
-
this is old and not related to leva but... const { camera, invalidate } = useThree();
useControls('camera', {
cameraPosition: {
value: { x: 1, y: 1, z: 1 },
step: 0.01,
onChange: (v) => {
camera.position.copy(v);
invalidate();
},
},
cameraTarget: {
value: { x: 0, y: 0, z: 0 },
step: 0.01,
onChange: (v) => {
orbitControls.current.target.copy(v);
invalidate();
},
},
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
romankoho
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is old and not related to leva but...
your canvas is setup to render on "demand" so you need to use
invalidate()
: