Voxel Struct
advanced scriptingVoxel Play 3 · Scripting / API
Overview
The Voxel struct defines any voxel in Voxel Play inside a chunk. It is implemented as a partial structure allowing additional fields in separate files.
Fields
Content and Type
ushort typeIndex- Index to the voxel definitions arraybool hasContent- Returns true if voxel is not emptybool isEmpty- Returns/sets whether voxel is emptybool isHole- Returns/sets whether voxel is a holebool isSolid- Whether voxel is a solid blockVoxelDefinition type- Returns the voxel definition object
Light Properties
byte opaque- Ranges 0-15 for opacity levels (0 = transparent, >0 = opaque with light reduction)byte light- Sun light amount (0-15)byte torchLight- Torch light amount (0-15)int packedLight- Packed Sun and Torch light intensitiesint lightOrTorch- Max of light and torchLight
Color / Tinting
byte red,byte green,byte blue- RGB tint values (255 when tinting is not enabled)Color32 color- Retrieve/set tint colorbool isColored- Returns true if a non-white tint is appliedbool supportsTinting(static) - Whether tinting is enabled in the project
Water and Rotation
int GetWaterLevel()- Returns water amount (0-15)void SetWaterLevel(int value)- Sets water amountbool hasWater- Indicates water presenceint GetTextureRotation()- Returns rotation index (0=0, 1=90, 2=180, 3=270 degrees)float GetTextureRotationDegrees()- Returns rotation in degreesvoid SetTextureRotation(int value)- Sets rotation index
Methods
void Clear(byte light)- Clear voxel to empty statestatic void Clear(Voxel[] voxels, byte light)- Clear array of voxelsvoid Set(VoxelDefinition type)- Set voxel type without tintvoid Set(VoxelDefinition type, Color32 tintColor)- Set voxel type with tint color
Constants
Voxel.Empty- Represents an empty voxelVoxel.Hole- Represents a hole voxelint memorySize- Memory size per voxel (10 bytes with tinting, 7 without)
Was this page helpful?
Suggest an improvement
Help us improve this documentation page.