0 votes

from godot documents:

getsurfacematerial ( int surface ) const:

Returns the Material for a surface of the Mesh resource.

what is this surface int?

I only see this in meshInstance:

enter image description here

I tried 0 to 10 but I get below error:

enter image description here

I need to use this but could not understand how it works. I think this deserves abetter explanation.

Godot version 3.3
in Engine by (16 points)

It looks like your images didn't load. Also you linked to an older version of the docs here is the one that matches your version, notice the 3.3 in the url. https://docs.godotengine.org/en/3.3/classes/class_meshinstance.html

1 Answer

+1 vote

A mesh can have different surfaces so when requesting a surface you have to specify which surface by giving an index. Consider a mesh with different parts (like a car with a windshield, the body etc) which have different materials, each part could be its own surface with different materials.

by (2,017 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.