Trouble overriding Object3D.matrix
in R3F vs vanilla
#1419
Replies: 3 comments 9 replies
-
#1786 might be related |
Beta Was this translation helpful? Give feedback.
-
the mesh already has a matrix, all you'd need is a ref const ref = useRef()
useFrame(() => {
ref.current.matrix.set(...)
})
return <mesh ref={ref} matrixAutoUpdate={false} /> the issue how it calls you can either set the matrix on the object directly or you wire the external up yourself inside a useLayoutEffect |
Beta Was this translation helpful? Give feedback.
-
some further observations, the object has to have both <mesh matrix-copy={null} matrix={matrix} matrixAutoUpdate={false} /> though that seems a bit weird and will make it harder to parse the code. not an easy problem, if you have more ideas let me know. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In vanilla Three.js, I can rewire an object's
.matrix
to point to my ownTHREE.Matrix4()
and then perform updates on that matrix:https://jsfiddle.net/mattrossman/4au067nt/
However, the same setup in R3F doesn't work:
https://codesandbox.io/s/cs8f0
Have I messed something up in translation, or is this a bug?
Beta Was this translation helpful? Give feedback.
All reactions