Connect mesh with associated data

Hi guys,

in my project I am creating a scene with several meshes. All of 3D Data for generating of these meshes comes from a json file. In this file theres additional information for every mesh: Name, Description, Number…
Now I want to implement an object ( a list, a dictionary or whatever ) that stores this information for all meshes and is kind of linked to the meshes. If I click on a mesh, the information of this mesh, that is stored in the object, should be displayed. (I already know some ways to display the information)

What I already did is to attach the information of every mesh to the mesh itself during the creating of the mesh. therefore I used “mesh.name =…” and “mesh.discription =…” . But this seems not to be the best way to do it.

Do you have any ideas, how I can do it in a nicer way? Is it possible to use an extra object like I mentioned above?

greeetings

Hello you can either use the metadata field and use it with all that you need like:

mesh.metadata = {
 foo: "1",
 bar: "hello:
}

Or you can also use the tags system: How to Use Tags in Babylon.js - Babylon.js Documentation

1 Like