VoxelBlockyModel

Inherits: Resource

Inherited by: VoxelBlockyModelCube, VoxelBlockyModelEmpty, VoxelBlockyModelMesh

Model stored in VoxelBlockyLibrary 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 VoxelBlockyLibrary to be used with VoxelTerrain or directly with a VoxelMesherBlocky.

A model can be setup in various ways, see child classes.

Properties:

Type Name Default
AABB[] collision_aabbs []
int collision_mask 1
Color color Color(1, 1, 1, 1)
bool culls_neighbors true
bool random_tickable false
int transparency_index 0
bool transparent (deprecated) false

Methods:

Return Signature
Material get_material_override ( int index ) const
bool is_mesh_collision_enabled ( int surface_index ) const
void rotate_90 ( int axis, bool clockwise )
void set_material_override ( int index, Material material )
void set_mesh_collision_enabled ( int surface_index, bool enabled )

Enumerations:

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

AABB[] collision_aabbs = []

List of bounding boxes relative to the model. They are used for box-based collision, using VoxelBoxMover. They are not used with mesh-based collision.

int collision_mask = 1

Collision mask used for box-based collision VoxelBoxMover and voxel raycasts (VoxelToolTerrain). It is not used for mesh-based collisions.

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

Color of the model. It will be used to modulate its color when built into a voxel mesh.

bool culls_neighbors = true

If enabled, this voxel culls the faces of its neighbors. Disabling can be useful for denser transparent voxels, such as foliage.

bool random_tickable = false

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

int transparency_index = 0

Determines how transparency is handled when the sides of the model are culled by neighbor voxels.

If the neighbor voxel at a given side has a transparency index lower or equal to the current voxel, the side will be culled.

bool transparent = false

This property is deprecated. Use VoxelBlockyModel.transparency_index instead. Tells if the model is transparent in the context of sides being culled by neighbor voxels.

Method Descriptions

Material get_material_override( int index )

Gets the material override for a specific surface of the model.

bool is_mesh_collision_enabled( int surface_index )

Tells if a specific surface produces mesh-based collisions.

void rotate_90( int axis, bool clockwise )

(This method has no documentation)

void set_material_override( int index, Material material )

Sets a material override for a specific surface of the model. It allows to use the same mesh on multiple models, but using different materials on each.

void set_mesh_collision_enabled( int surface_index, bool enabled )

Enables or disables mesh-based collision on a specific surface. It allows a model to have solid parts and others where players can pass through.

Generated on Apr 06, 2024