Struct Mesh

A Resource that contains vertex array-based geometry.

struct Mesh ;

Mesh is a type of Resource that contains vertex array-based geometry, divided in surfaces. Each surface contains a completely separate array and a material used to draw it. Design wise, a mesh with multiple surfaces is preferred to a single surface, because objects created in 3D editing software commonly contain multiple materials.

Properties

NameTypeDescription
lightmapSizeHint[get, set] Vector2Sets a hint to be used for lightmap resolution in BakedLightmap. Overrides BakedLightmap.bakeDefaultTexelsPerUnit.

Methods

NameDescription
createConvexShape Calculate a ConvexPolygonShape from the mesh.
createOutline Calculate an outline mesh at a defined offset (margin) from the original mesh. Note: This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
createTrimeshShape Calculate a ConcavePolygonShape from the mesh.
generateTriangleMesh Generate a TriangleMesh from the mesh.
getAabb Returns the smallest AABB enclosing this mesh. Not affected by custom_aabb. Note: This is only implemented for ArrayMesh and PrimitiveMesh.
getFaces Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
getLightmapSizeHint
getSurfaceCount Returns the amount of surfaces that the Mesh holds.
setLightmapSizeHint
surfaceGetArrays Returns the arrays for the vertices, normals, uvs, etc. that make up the requested surface (see ArrayMesh.addSurfaceFromArrays).
surfaceGetBlendShapeArrays Returns the blend shape arrays for the requested surface.
surfaceGetMaterial Returns a Material in a given surface. Surface is rendered using this material.
surfaceSetMaterial Sets a Material for a given surface. Surface will be rendered using this material.

Enums

NameDescription
ArrayFormat
ArrayType
BlendShapeMode
Constants
PrimitiveType