How do I update the UV mapping for a shapeGeometry? #1488
Unanswered
wileyknight
asked this question in
Q&A
Replies: 1 comment
-
the example mutates the existing geom after creation but before rendering out. in react that is a layout effect. this will also be more efficient than usememo + args because you would be re-creating the geometry every time props change otherwise. args are literally constructor arguments: const mesh = useRef()
useLayoutEffect(() => {
mesh.current.geometry.attributes.uv.setXY(...
}, [x, y])
return (
<mesh ref={mesh}>
...
|
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.
-
I have a shape geometry that I've added to my scene and everything works on that just fine until I try to texture the shape. The mapping is off. I found this snippet that should fix my problem but I have no idea how to get this to work within r3f.
Here is the full example:
https://jsfiddle.net/prisoner849/yn2z0e1w/
Where and how do I attach this example's box UV to the geometry UV?
Beta Was this translation helpful? Give feedback.
All reactions