Skip to main content

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

int 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.
surf_idx
int
The surface index

surface_set_material

void surface_set_material(surf_idx: int, material: Material)
Sets a Material for a given surface.

get_aabb

AABB 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)

Build docs developers (and LLMs) love