• Godot Help3D
  • How can I change the material of a single instance ?

Hello everybody,

I'm currently working on Hop! 3D, my new 3D platformer and I'm stuck because of a material problem.

Here's the context : in my game, Hop, the main character, is looking for "infocubes". Each of them displays info when Hop gets near. I created a infocube as an individual scene and my level contains many infocubes as packed scenes. When an infocube is "active", I make it rotate faster but I'd also like to enable its material emission to make it more obvious for the player.

I tried to change this property using code but all infocubes (even the ones Hop is far from) are affected instead of only one (see pictures below).


inactive infocubes


all infocubes active instead of one !

How can I change this ?

Thanks for your help.

  • xyz replied to this.

    Asthalis Make sure the material is assigned to material_override property of the mesh instance, and enable material's local_to_scene flag.

      xyz
      Thanks a lot, it worked !
      I had already noticed the material_override option but never really knew how to use the local_to_scene command. That's clearer to me now.