> ## 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

# 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

```gdscript theme={null}
int get_surface_count()
```

Returns the number of surfaces that the Mesh holds.

### surface\_get\_material

```gdscript theme={null}
Material surface_get_material(surf_idx: int)
```

Returns a Material in a given surface.

<ParamField path="surf_idx" type="int">
  The surface index
</ParamField>

### surface\_set\_material

```gdscript theme={null}
void surface_set_material(surf_idx: int, material: Material)
```

Sets a Material for a given surface.

### get\_aabb

```gdscript theme={null}
AABB get_aabb()
```

Returns the smallest AABB enclosing this mesh in local space.

### create\_trimesh\_shape

```gdscript theme={null}
ConcavePolygonShape3D create_trimesh_shape()
```

Calculate a ConcavePolygonShape3D from the mesh.

## Example Usage

<Tabs>
  <Tab title="GDScript">
    ```gdscript theme={null}
    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)
    ```
  </Tab>

  <Tab title="C#">
    ```csharp theme={null}
    var mesh = GD.Load<Mesh>("res://models/character.obj");
    GD.Print("Surface count: ", mesh.GetSurfaceCount());
    ```
  </Tab>
</Tabs>
