Passing Points component ref to Recoil causes errors. #847
Unanswered
tomatualus
asked this question in
Q&A
Replies: 1 comment
-
i think you need to post this on recoils github. the ref just contains an instance to THREE.Points. if recoil doesn't handle that then it's probably messing with it in some way. im also not sure about how you feed it vertices. it should be: const [vertices] = useState(() => [
[-1, -1, 1], [1, -1, 1], [-1, 1, 1], [1, 1, 1],
[-1, -1, -1], [1, -1, -1], [-1, 1, -1], [1, 1, -1],
].map(a => new THREE.Vector3(...a)) updating buffers in threejs is a bit odd, im am not sure what happens if you simply overwrite vertices on a new render pass, this could perhaps be your problem. there's a document explaining it: https://threejs.org/docs/index.html#manual/en/introduction/How-to-update-things |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I am using react-three-fiber and recoil together to play around. What i stumbled upon almost instantly, is that when i set atoms value to a components ref, i get many errors.
And ofcourse the root component
The errors are
TypeError: "x" is read-only
orTypeError: "vertices" is read-only
or many more. Any help on this?Ofcourse - why am i doing this? I need the components reference so i can raycast it, simple as that. I COULD use React.forwardRef, but if that would be the case, i would have prop hell soon.
Beta Was this translation helpful? Give feedback.
All reactions