Table of Contents

Class PrimitiveMesh

Namespace
Godot
Assembly
GodotSharp.dll

Base class for all primitive meshes. Handles applying a Material to a primitive mesh. Examples include BoxMesh, CapsuleMesh, CylinderMesh, PlaneMesh, PrismMesh, and SphereMesh.

public class PrimitiveMesh : Mesh, IDisposable
Inheritance
PrimitiveMesh
Implements
Derived
Inherited Members

Constructors

PrimitiveMesh()

public PrimitiveMesh()

Properties

AddUV2

If set, generates UV2 UV coordinates applying a padding using the UV2Padding setting. UV2 is needed for lightmapping.

public bool AddUV2 { get; set; }

Property Value

bool

CustomAabb

Overrides the Aabb with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices.

public Aabb CustomAabb { get; set; }

Property Value

Aabb

FlipFaces

If set, the order of the vertices in each triangle are reversed resulting in the backside of the mesh being drawn.

This gives the same result as using Front in CullMode.

public bool FlipFaces { get; set; }

Property Value

bool

Material

The current Material of the primitive mesh.

public Material Material { get; set; }

Property Value

Material

UV2Padding

If AddUV2 is set, specifies the padding in pixels applied along seams of the mesh. Lower padding values allow making better use of the lightmap texture (resulting in higher texel density), but may introduce visible lightmap bleeding along edges.

If the size of the lightmap texture can't be determined when generating the mesh, UV2 is calculated assuming a texture size of 1024x1024.

public float UV2Padding { get; set; }

Property Value

float

Methods

GetMeshArrays()

Returns mesh arrays used to constitute surface of Mesh. The result can be passed to AddSurfaceFromArrays(PrimitiveType, Array, Array<Array>, Dictionary, ArrayFormat) to create a new surface. For example:

var c = new CylinderMesh();
  var arrMesh = new ArrayMesh();
  arrMesh.AddSurfaceFromArrays(Mesh.PrimitiveType.Triangles, c.GetMeshArrays());
public Array GetMeshArrays()

Returns

Array

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

_CreateMeshArray()

Override this method to customize how this primitive mesh should be generated. Should return an Array where each element is another Array of values required for the mesh (see the Mesh.ArrayType constants).

public virtual Array _CreateMeshArray()

Returns

Array