#List of Meshes

7 messages · Page 1 of 1 (latest)

timid basalt
#

state should ideally only contain the most minimal data possible, best if its serialisable too

#

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 }]
}, [])
orchid abyss
#

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

orchid abyss