Update Complex Mesh after condition is satisfied #1827
-
Good evening, I am new to react-three-fiber, and I am facing a problem to update / render a complex mesh after a previous function returns a true boolean variable. The logic is:
Here is the code: `function setMesh () {
} export const DrawBackFacade = () => {
}` Any thoughts would be helpful! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
i believe in threejs you cant change buffergeometry like that. see: https://threejs.org/docs/#manual/en/introduction/How-to-update-things you need to give it a buffer and then you can mutate it inside a useLayoutEffect. you can't increase the size of the buffer. |
Beta Was this translation helpful? Give feedback.
-
Hello @drcmda and others. I found a solution following the suggestion of mutating the bufferGeometry + useFrame hook to check for updates. Below you can see the solution. Hope it could be useful for others. ` export const DrawMesh = (props) => {
}; |
Beta Was this translation helpful? Give feedback.
i believe in threejs you cant change buffergeometry like that. see: https://threejs.org/docs/#manual/en/introduction/How-to-update-things
you need to give it a buffer and then you can mutate it inside a useLayoutEffect. you can't increase the size of the buffer.