#List of Meshes
7 messages · Page 1 of 1 (latest)
you can of course stick meshes into an array, or classes, functions whatever, but but why would you
const [meshes, set] = useState(() => [
{ id: guid(), position: [1,2,3], ... },
{ id: guid(), rotation: [1,2,3], ... },
...
])
return meshes.map(({ id, ...props }) => <mesh key={id} {...props} />
whenever meshes changes the view will adapt, for instance adding one
useEffect(() => {
set(meshes => [...meshes, { id: guid(), scale: 10 }]
}, [])
oh okay thank you
basically i want some meshes to appear in case the user wants them to or not
so the user has the choice of them appearing
that's why i want my meshes in an array
can i edit the array with other functions if i do it like this?