pyunity.meshes module

Module for prebuilt meshes.

class pyunity.meshes.Mesh(verts, triangles, normals)

Bases: object

Class to create a mesh for rendering with a MeshRenderer

Parameters
  • verts (list) – List of Vector3’s containing each vertex

  • triangles (list) – List of ints containing triangles joining up the vertexes. Each int is the index of a vertex above.

  • normals (list) – List of Vector3’s containing the normal of each triangle. Unlike Unity, PyUnity uses normals per triangle.

verts

List of Vector3’s containing each vertex

Type

list

triangles

List of ints containing triangles joining up the vertexes. Each int is the index of a vertex above.

Type

list

normals

List of Vector3’s containing the normal of each triangle. Unlike Unity, PyUnity uses normals per triangle.

Type

list

static cube(size)

Creates a cube mesh.

Parameters

size (float) – Side length of cube

Returns

A cube centered at Vector3(0, 0, 0) that has a side length of size

Return type

Mesh

static double_quad(size)

Creates a two-sided quadrilateral mesh.

Parameters

size (float) – Side length of quad

Returns

A double-sided quad centered at Vector3(0, 0) with side length of size facing in the direction of the negative z axis.

Return type

Mesh

static quad(size)

Creates a quadrilateral mesh.

Parameters

size (float) – Side length of quad

Returns

A quad centered at Vector3(0, 0) with side length of size facing in the direction of the negative z axis.

Return type

Mesh