VoxelBlockyModelMesh
Generates a model based on a custom mesh.
Generates a model based on a custom mesh.
VoxelMesherBlocky does not require models to be cubes. Ultimately, model visuals are all meshes. This is the most versatile option to make a model. The workflow is to make these models in a 3D editor such as Blender, making sure they are confined in a box going from (0,0) to (1,1). Textures are assigned with classic UV-mapping.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelBlockyModelMeshConstructor
public VoxelBlockyModelMesh();Properties4
MeshProperty
public Mesh Mesh { get; set; }Mesh that will be used for this model. Must not be empty (if you want an empty model, use VoxelBlockyModelEmpty). If it has more than 2 surfaces (2 materials) the next surfaces will be ignored. Surfaces must be made of triangles. Must be indexed (if you generate meshes with SurfaceTool, use SurfaceTool.Index). Should ideally contain geometry within a 0..1 area. Only triangles located on the sides of that cubic area will be considered for neighbor side culling (see also VoxelBlockyModelMesh.SideVertexTolerance).
MeshOrthoRotationIndexProperty
public int MeshOrthoRotationIndex { get; set; }Orthogonal rotation applied to the mesh when baking. Values are taken from the same convention as GridMap tiles.
(GridMap provides a conversion method from Basis, unfortunately it is not a static method so it requires a GridMap instance to exist. A helper method could be added in the future if requested)
SideCutoutEnabledProperty
public bool SideCutoutEnabled { get; set; }When a neighbor voxel partially covers a side of this voxel, the occluded geometry of the side will be cut away. This only works if the shape of both sides is a rectangle. Note, enabling this option can actually produce more triangles than when it is enabled.
SideVertexToleranceProperty
public float SideVertexTolerance { get; set; }Margin below which triangles located near one of the 6 sides of the voxel will be considered on that side. Sides get culled or not by comparing between triangles of neighbor sides.
Methods6
GetMeshMesh
public Mesh GetMesh();MeshGetSideVertexTolerancefloat
public float GetSideVertexTolerance();floatIsSideCutoutEnabledbool
public bool IsSideCutoutEnabled();boolSetMeshvoid
public void SetMesh(Mesh mesh);| Name | Type | Default |
|---|---|---|
mesh | Mesh | — |
SetSideCutoutEnabledvoid
public void SetSideCutoutEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetSideVertexTolerancevoid
public void SetSideVertexTolerance(float tolerance);| Name | Type | Default |
|---|---|---|
tolerance | float | — |