I have this model here:
I want to make it a audio visualizer but i think it is easier to do if i just make a grid of cubes using the heightmap from this model.
But how do i make cubes duplicate and change its height to match this model here? I want to replicate this model without using a GLTF loader?
How would using the height of cubes from the model create a visualiser ? Wouldn’t the height be dynamic and dependent on audio?
You can still use the cubes from the model - just export the entire scene to a GLTF and traverse it to read / modify vertical scale of the cubes.
Use an instance mesh to create a grid of cubes. You can adjust the height on every frame using data from audio. Instance mesh with 30K cubes is very quick.
Here’s an example that’s 150 x 150. Click on the image to displace the cubes.
the model is just one big mesh so it is hard to go get the individual cubes. And yes the height shown in the model is the standard height, the audio would make them higher
instance mesh has at() methods which allow you access to individual instances. For each instance, you can change the scale and color.
I found the instanced mesh raycast example to be very helpful.
Here’s the code in that example for accessing instances
Thanks for the great example, i have now ported the code into my project but i seem to be stuck to make space between the cubes as the now just form a big line of boxes
Any idea how to do that?