-
So I'm sharing material between geometries via import { Plane, Sphere, Torus } from '@react-three/drei'
import { useState } from 'react'
function Model() {
const [material, setMaterial] = useState()
return (
<>
<meshBasicMaterial ref={setMaterial} color="aqua" />
{material && (
<>
<Sphere args={[1, 32, 32]} material={material} />
<Plane args={[2, 2]} position={[3, 0, 0]} material={material} />
<Torus args={[1, 0.5, 32, 32]} position={[-3.5, 0, 0]} material={material} />
</>
)}
</>
)
} But the geometries aren't being updated with the materials. Codesandbox link: https://codesandbox.io/s/shared-material-issue-6mm78 |
Beta Was this translation helpful? Give feedback.
Answered by
drcmda
Oct 21, 2021
Replies: 1 comment 2 replies
-
normalmaterial does not have a color. opacity seems to react fine. that it doesn't work on first render is because of stage/center, which expects geometry to be present, but on first render there's none. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
hazem3500
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
normalmaterial does not have a color. opacity seems to react fine. that it doesn't work on first render is because of stage/center, which expects geometry to be present, but on first render there's none.