Voxel Struct

advanced scripting

Voxel 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 array
  • bool hasContent - Returns true if voxel is not empty
  • bool isEmpty - Returns/sets whether voxel is empty
  • bool isHole - Returns/sets whether voxel is a hole
  • bool isSolid - Whether voxel is a solid block
  • VoxelDefinition 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 intensities
  • int 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 color
  • bool isColored - Returns true if a non-white tint is applied
  • bool 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 amount
  • bool hasWater - Indicates water presence
  • int GetTextureRotation() - Returns rotation index (0=0, 1=90, 2=180, 3=270 degrees)
  • float GetTextureRotationDegrees() - Returns rotation in degrees
  • void SetTextureRotation(int value) - Sets rotation index

Methods

  • void Clear(byte light) - Clear voxel to empty state
  • static void Clear(Voxel[] voxels, byte light) - Clear array of voxels
  • void Set(VoxelDefinition type) - Set voxel type without tint
  • void Set(VoxelDefinition type, Color32 tintColor) - Set voxel type with tint color

Constants

  • Voxel.Empty - Represents an empty voxel
  • Voxel.Hole - Represents a hole voxel
  • int memorySize - Memory size per voxel (10 bytes with tinting, 7 without)
Was this page helpful?