How do I use multimesh instance ona mesh instance that is being created in code - 3D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dragon20C

I will explain it as simple as possible,First im trying to create a minecrafty voxel game, i am instancing around 10,000 mesh’s obviously this isn’t very performant, and I started looking for a way to optimize performance, and I found multi-mesh instance it sounds great and exactly what im looking for, but I go to the docs and Im clueless I have no clue on how to implement it into my code.

To make it easier for you guys to understand what I want I will post my code in a link here:

:bust_in_silhouette: Reply From: Lopy

GridMaps are much closer to what you want to implement.

Edit: Since you really want to use MultiMesh.

Mesh and MultiMesh are Resources, containing information about what to display. MeshInstance and MultiMeshInstance are Spatials which can display them.

Basic code to create a MultiMesh can be found here. Once created, simply put it into a MultiMeshInstance in the tree to display it.

Since you will probably have quite a few blocks, you may want to use MeshLibrary anyway, even without any GridMap (for convenient storage). If the default way of creating one is insuficient for you, see this answer to create one by code.

Thanks, I’m aware of gridmaps but I like to accomplish this without it.

Dragon20C | 2021-02-17 06:15