Is there a way to get the material of an object?

I’ve some models loaded with animation (just walking around) and collisions, my main character (which I control) has a script in which detects the collision of each object and shows a plane of the collision object has, but I don’t know if there is a way in which I can get the material o texture of that plane?

Hi @Axel_Saucedo ,

You can get the material of a specific mesh instance of a model this way:

To get the texture/diffuse map you can do this:

This will get you the material of the first mesh instance of that model and you can loop through the meshinstances to get all the materials of that model.

Here is a simple example of switching materials:

and in the script switching-materials.js, you can see how the materials are accessed and switched:
Line 27: