Skip to content

Debug camera (react-three/drei) #494

Answered by Remi-Tribia
romankoho asked this question in Q&A
Discussion options

You must be logged in to vote

this is old and not related to leva but...
your canvas is setup to render on "demand" so you need to use invalidate() :

  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();
      },
    },
  });

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@romankoho
Comment options

Answer selected by romankoho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants