Documentation Index
Fetch the complete documentation index at: https://mintlify.com/godotengine/godot/llms.txt
Use this file to discover all available pages before exploring further.
Mesh
Inherits: Resource < RefCounted < Object
Description
A Resource that contains vertex array-based geometry. Mesh is divided in surfaces, each containing a separate array and material.
Methods
get_surface_count
Returns the number of surfaces that the Mesh holds.
surface_get_material
Material surface_get_material(surf_idx: int)
Returns a Material in a given surface.
surface_set_material
void surface_set_material(surf_idx: int, material: Material)
Sets a Material for a given surface.
get_aabb
Returns the smallest AABB enclosing this mesh in local space.
create_trimesh_shape
ConcavePolygonShape3D create_trimesh_shape()
Calculate a ConcavePolygonShape3D from the mesh.
Example Usage
var mesh = load("res://models/character.obj")
print("Surface count: ", mesh.get_surface_count())
# Get material from first surface
var material = mesh.surface_get_material(0)
var mesh = GD.Load<Mesh>("res://models/character.obj");
GD.Print("Surface count: ", mesh.GetSurfaceCount());