Replies: 2 comments 4 replies
-
i tried and i dont see an issue: https://codesandbox.io/s/r3f-render-target-cq68q?file=/src/index.js:1059-1119 useEffect(() => {
cam.current.lookAt(1, 0, 0)
}, []) my guess is that by putting camera.lookAt into useUpdate (which is undefined, the property does not exist) it never updates. is there a reason you're using a custom cam? you can do the same with the default cam btw: https://codesandbox.io/s/r3f-basic-demo-nsb7f |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, your solution isn't working for me. I've exported a CodeSandbox (not a Pro yet): All the action happens in components/modelcanvas-three.js. The red sphere is rendered at the target point, the same one used to set cam.current.lookAt(). Is the trackball interfering? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Has anyone managed to point a drei
PerspectiveCamera
at something other than the origin? I'm struggling. I've trieduseUpdate
and other hooks, but my understanding of these is admittedly shaky. It seems like a common enough use-case.This code does not show the effect of the initial camera.lookAt state. Furthermore, it fails when camera.lookAt is modified in the state (Redux), showing "TypeError: invalidate is not a function" from an anonymous function inside commitHookEffectListMount.
On a related note, has anyone seen a more expansive write-up of the r3f hooks? The main
api.md
descriptions are pretty thin on explanations, or I'm just dense.Beta Was this translation helpful? Give feedback.
All reactions