-
Hi all. I have a project where I draw a 3 dimensional plot. I have a set of 3d axes - a scaled axesHelper - and then what's effectively a 2d heightmap plotted in 3d. It rotates around the X axes so that the viewer gets an idea of the map. I just upgraded to version 6 and now the axes and data plot have parted ways. The axes seem fine - that already used useEffect - but the data mesh is there but seemingly failing to translate, and/or there's some other translation/rotation/ordering issue going on that I can't seem to get my head around and I can't reconcile them to get them back together. I have tried setting the mesh position "manually" using Previously the code did this: const buffer = useUpdate(geometry => {
geometry.translate(-14.5, -7.5, 0);
geometry.rotateX(-Math.PI/2);
geometry.setAttribute(
"color",
new Uint8BufferAttribute(cSet, COMPONENTS_PER_COLOUR, true)
);
// Smooth mesh please
geometry.computeVertexNormals();
}, []); And based on the comments in the changelog, I have changed it to this: const buffer = useRef(null);
useLayoutEffect(() => {
const geometry = buffer.current;
geometry.translate(-14.5, -7.5, 0);
geometry.rotateX(-Math.PI/2);
geometry.setAttribute(
"color",
new Uint8BufferAttribute(cSet, COMPONENTS_PER_COLOUR, true)
);
// Smooth mesh please
geometry.computeVertexNormals();
}, []); Ideas/thoughts greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
the code should be the same, useUpdate did just that, a wrapper around uLE. the error must be somewhere else. do you have a super-reduced repro as a codesandbox? |
Beta Was this translation helpful? Give feedback.
the code should be the same, useUpdate did just that, a wrapper around uLE. the error must be somewhere else. do you have a super-reduced repro as a codesandbox?