Voxel

Inherits: Resource

Model stored in VoxelLibrary and used by VoxelMesherBlocky.

Description:

Represents a model to be used for voxels of a specific TYPE value. Such models must be contained within a VoxelLibrary to be used with VoxelTerrain or directly with a VoxelMesherBlocky.

Some other various properties also exist to make it easier to implement games based on this technique (such as Minecraft).

Properties:

Type Name Default
Array collision_aabbs [ ]
int collision_mask 1
Color color Color( 1, 1, 1, 1 )
Mesh custom_mesh
int geometry_type 0
int material_id 0
bool random_tickable false
int transparency_index 0
bool transparent false
String voxel_name ""

Methods:

Return Signature
int get_id ( ) const
bool is_empty ( ) const
void set_id ( int id )

Enumerations:

enum GeometryType:

  • GEOMETRY_NONE = 0 --- Don't produce any geometry. The voxel will be invisible.
  • GEOMETRY_CUBE = 1 --- Use the shape of a generated cube. It is useful for testing and quick configuration.
  • GEOMETRY_CUSTOM_MESH = 2 --- Use the mesh specified in the [member mesh] property. This is the most versatile way to create shapes.
  • GEOMETRY_MAX = 3 --- How many geometry modes there are.

enum Side:

  • SIDE_NEGATIVE_X = 1
  • SIDE_POSITIVE_X = 0
  • SIDE_NEGATIVE_Y = 2
  • SIDE_POSITIVE_Y = 3
  • SIDE_NEGATIVE_Z = 4
  • SIDE_POSITIVE_Z = 5
  • SIDE_COUNT = 6

Property Descriptions

  • Array collision_aabbs = [ ]

  • int collision_mask = 1

  • Color color = Color( 1, 1, 1, 1 )

  • Mesh custom_mesh

  • int geometry_type = 0

  • int material_id = 0

ID of the material that will be used. It corresponds to the index of materials found on VoxelTerrain.

  • bool random_tickable = false

If enabled, voxels having this ID in the TYPE channel will be used by method VoxelToolTerrain.run_blocky_random_tick.

  • int transparency_index = 0

  • bool transparent = false

  • String voxel_name = ""

Name that can be used for convenience, when looking up a specific Voxel from VoxelLibrary.

Method Descriptions

Generated on May 31, 2021