react-three-fiber
react-three-fiber copied to clipboard
Support translation of geometries
Right now to translate a geometry we need to take a ref and call the translate function in a useEffect
hook.
I'd like to be able to apply a translation through JSX directly.
// now
const ref = useRef<PlaneGeometry>(null!)
useEffect(() => {
ref.current.translate(sz / 2, -sz / 2, 0)
}, [])
return (
<mesh>
<planeGeometry args={[sz, sz]} ref={ref} />
{/* ... */}
</mesh>
);
// proposal
return (
<mesh>
<planeGeometry args={[sz, sz]} translation={[sz / 2, -sz / 2, 0]} />
{/* ... */}
</mesh>
)