reckfellENGINE

VoxelTerrain

Voxel volume using constant level of detail.

On this page
class VoxelTerrainReckfellSharpInherits VoxelEntity

Voxel volume using constant level of detail.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

VoxelTerrainConstructor
# VoxelTerrain
C#
public VoxelTerrain();

Properties17

AreaEditNotificationEnabledProperty
# AreaEditNotificationEnabled
C#
public bool AreaEditNotificationEnabled { get; set; }
AutomaticLoadingEnabledProperty
# AutomaticLoadingEnabled
C#
public bool AutomaticLoadingEnabled { get; set; }

If turned off, the terrain will no longer automatically load blocks around viewers locally. This may be used in multiplayer scenarios, when the terrain is client-side, because blocks will be sent by the server instead.

BlockEnterNotificationEnabledProperty
# BlockEnterNotificationEnabled
C#
public bool BlockEnterNotificationEnabled { get; set; }
BoundsProperty
# Bounds
C#
public Aabb Bounds { get; set; }

Defines the bounds within which the terrain is allowed to have voxels. If an infinite world generator is used, blocks will only generate within this region. Everything outside will be left empty. If any dimension of the new bounds is larger than 512 and VoxelTerrain.MaxViewDistance is larger than 512, then VoxelTerrain.MaxViewDistance will be clamped to 512. This measure is to avoid crashing due to a potential huge amount of chunks that would load.

CollisionLayerProperty
# CollisionLayer
C#
public int CollisionLayer { get; set; }
CollisionMarginProperty
# CollisionMargin
C#
public float CollisionMargin { get; set; }
CollisionMaskProperty
# CollisionMask
C#
public int CollisionMask { get; set; }
DebugDrawEnabledProperty
# DebugDrawEnabled
C#
public bool DebugDrawEnabled { get; set; }
DebugDrawShadowOccludersProperty
# DebugDrawShadowOccluders
C#
public bool DebugDrawShadowOccluders { get; set; }
DebugDrawVisualAndCollisionBlocksProperty
# DebugDrawVisualAndCollisionBlocks
C#
public bool DebugDrawVisualAndCollisionBlocks { get; set; }
DebugDrawVolumeBoundsProperty
# DebugDrawVolumeBounds
C#
public bool DebugDrawVolumeBounds { get; set; }
DebugDrawVoxelMetadataProperty
# DebugDrawVoxelMetadata
C#
public bool DebugDrawVoxelMetadata { get; set; }
GenerateCollisionsProperty
# GenerateCollisions
C#
public bool GenerateCollisions { get; set; }

Enables the generation of collision shapes using the classic physics engine. Use this feature if you need realistic or non-trivial collisions or physics. Note 1: you also need VoxelViewer to request collisions, otherwise they won't generate. Note 2: If you need simple Minecraft/AABB physics, you can use VoxelBoxMover which may perform better in blocky worlds.

MaterialOverrideProperty
# MaterialOverride
C#
public Material MaterialOverride { get; set; }
MaxViewDistanceProperty
# MaxViewDistance
C#
public int MaxViewDistance { get; set; }

Sets the maximum distance this terrain can support. If a VoxelViewer requests more, it will be clamped.

MeshBlockSizeProperty
# MeshBlockSize
C#
public uint MeshBlockSize { get; set; }

Sets how many voxels across meshes of the terrain span. Voxel chunks are stored in cubic chunks of 16x16x16 voxels, and by default meshes of the terrain match that size. But you can set this to 32 so meshes will span 2x2x2 voxel chunks. This is a performance tradeoff. Higher mesh size may speed up rendering, at the cost of slower mesh updates. Values other than 16 and 32 are not supported. Note: this setting also affects VoxelInstancer chunks.

UseGpuGenerationProperty
# UseGpuGeneration
C#
public bool UseGpuGeneration { get; set; }

Enables GPU block generation, which can speed it up. This is only valid for generators that support it. Vulkan is required.

Methods42

DataBlockToVoxelVector3I
# DataBlockToVoxel
C#
public Vector3I DataBlockToVoxel(Vector3I blockPos);

Converts data block coordinates into voxel coordinates. Voxel coordinates of a block correspond to its lowest corner.

Parameters
NameTypeDefault
blockPosVector3I—
Returns Vector3I
DebugGetDrawFlagbool
# DebugGetDrawFlag
C#
public bool DebugGetDrawFlag(VoxelTerrain.DebugDrawFlag flagIndex);
Parameters
NameTypeDefault
flagIndexVoxelTerrain.DebugDrawFlag—
Returns bool
DebugGetDrawShadowOccludersbool
# DebugGetDrawShadowOccluders
C#
public bool DebugGetDrawShadowOccluders();
Returns bool
DebugIsDrawEnabledbool
# DebugIsDrawEnabled
C#
public bool DebugIsDrawEnabled();
Returns bool
DebugSetDrawEnabledvoid
# DebugSetDrawEnabled
C#
public void DebugSetDrawEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
DebugSetDrawFlagvoid
# DebugSetDrawFlag
C#
public void DebugSetDrawFlag(VoxelTerrain.DebugDrawFlag flagIndex, bool enabled);
Parameters
NameTypeDefault
flagIndexVoxelTerrain.DebugDrawFlag—
enabledbool—
DebugSetDrawShadowOccludersvoid
# DebugSetDrawShadowOccluders
C#
public void DebugSetDrawShadowOccluders(bool enabled);
Parameters
NameTypeDefault
enabledbool—
GetBoundsAabb
# GetBounds
C#
public Aabb GetBounds();
Returns Aabb
GetCollisionLayerint
# GetCollisionLayer
C#
public int GetCollisionLayer();
Returns int
GetCollisionMarginfloat
# GetCollisionMargin
C#
public float GetCollisionMargin();
Returns float
GetCollisionMaskint
# GetCollisionMask
C#
public int GetCollisionMask();
Returns int
GetDataBlockSizeuint
# GetDataBlockSize
C#
public uint GetDataBlockSize();
Returns uint
GetGenerateCollisionsbool
# GetGenerateCollisions
C#
public bool GetGenerateCollisions();
Returns bool
GetGeneratorUseGpubool
# GetGeneratorUseGpu
C#
public bool GetGeneratorUseGpu();
Returns bool
GetMaterialOverrideMaterial
# GetMaterialOverride
C#
public Material GetMaterialOverride();
Returns Material
GetMaxViewDistanceint
# GetMaxViewDistance
C#
public int GetMaxViewDistance();
Returns int
GetMeshBlockSizeuint
# GetMeshBlockSize
C#
public uint GetMeshBlockSize();
Returns uint
GetStatisticsReckfell.Collections.Dictionary
# GetStatistics
C#
public Reckfell.Collections.Dictionary GetStatistics();

Gets debug information about how much time is spent processing the terrain. The returned dictionary has the following structure:

Text
{
    "time_detect_required_blocks": int,
    "time_request_blocks_to_load": int,
    "time_process_load_responses": int,
    "time_request_blocks_to_update": int,
    "time_process_update_responses": int,
    "remaining_main_thread_blocks": int,
    "dropped_block_loads": int,
    "dropped_block_meshs": int,
    "updated_blocks": int
}
Returns Reckfell.Collections.Dictionary
GetViewerNetworkPeerIdsInAreaint[]
# GetViewerNetworkPeerIdsInArea
C#
public int[] GetViewerNetworkPeerIdsInArea(Vector3I areaOrigin, Vector3I areaSize);
Parameters
NameTypeDefault
areaOriginVector3I—
areaSizeVector3I—
Returns int[]
HasDataBlockbool
# HasDataBlock
C#
public bool HasDataBlock(Vector3I blockPosition);
Parameters
NameTypeDefault
blockPositionVector3I—
Returns bool
IsAreaEditNotificationEnabledbool
# IsAreaEditNotificationEnabled
C#
public bool IsAreaEditNotificationEnabled();
Returns bool
IsAreaMeshedbool
# IsAreaMeshed
C#
public bool IsAreaMeshed(Aabb areaInVoxels);

Returns true if the area has been processed by meshing. It does not mean the area actually contains a mesh. Returns false if the area has not been processed by meshing (therefore it is unknown whethere there should be a mesh here or not). When streaming terrain, this can be used to determine if an area has fully "loaded", in case the game relies meshes or mesh colliders.

Parameters
NameTypeDefault
areaInVoxelsAabb—
Returns bool
IsAutomaticLoadingEnabledbool
# IsAutomaticLoadingEnabled
C#
public bool IsAutomaticLoadingEnabled();
Returns bool
IsBlockEnterNotificationEnabledbool
# IsBlockEnterNotificationEnabled
C#
public bool IsBlockEnterNotificationEnabled();
Returns bool
SaveBlockvoid
# SaveBlock
C#
public void SaveBlock(Vector3I position);

Forces a specific block to be saved. Note 1: this will only have an effect if the stream setup on this terrain supports saving. Note 2: saving is asynchronous and won't block the game. the save may complete only a short time after you call this method.

Parameters
NameTypeDefault
positionVector3I—
SaveModifiedBlocksVoxelSaveCompletionTracker
# SaveModifiedBlocks
C#
public VoxelSaveCompletionTracker SaveModifiedBlocks();

Forces all modified blocks to be saved. Note 1: this will only have an effect if the stream setup on this terrain supports saving. Note 2: saving is asynchronous and won't block the game. the save may complete only a short time after you call this method. Use the returned tracker object to know when saving has completed. However, saves occurring after calling this method won't be tracked by this object. Note that blocks getting unloaded as the viewer moves around can also trigger saving tasks, independently from this function.

Returns VoxelSaveCompletionTracker
SetAreaEditNotificationEnabledvoid
# SetAreaEditNotificationEnabled
C#
public void SetAreaEditNotificationEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetAutomaticLoadingEnabledvoid
# SetAutomaticLoadingEnabled
C#
public void SetAutomaticLoadingEnabled(bool enable);
Parameters
NameTypeDefault
enablebool—
SetBlockEnterNotificationEnabledvoid
# SetBlockEnterNotificationEnabled
C#
public void SetBlockEnterNotificationEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetBoundsvoid
# SetBounds
C#
public void SetBounds(Aabb bounds);
Parameters
NameTypeDefault
boundsAabb—
SetCollisionLayervoid
# SetCollisionLayer
C#
public void SetCollisionLayer(int layer);
Parameters
NameTypeDefault
layerint—
SetCollisionMarginvoid
# SetCollisionMargin
C#
public void SetCollisionMargin(float margin);
Parameters
NameTypeDefault
marginfloat—
SetCollisionMaskvoid
# SetCollisionMask
C#
public void SetCollisionMask(int mask);
Parameters
NameTypeDefault
maskint—
SetGenerateCollisionsvoid
# SetGenerateCollisions
C#
public void SetGenerateCollisions(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetGeneratorUseGpuvoid
# SetGeneratorUseGpu
C#
public void SetGeneratorUseGpu(bool enable);
Parameters
NameTypeDefault
enablebool—
SetMaterialOverridevoid
# SetMaterialOverride
C#
public void SetMaterialOverride(Material material);
Parameters
NameTypeDefault
materialMaterial—
SetMaxViewDistancevoid
# SetMaxViewDistance
C#
public void SetMaxViewDistance(int distanceInVoxels);
Parameters
NameTypeDefault
distanceInVoxelsint—
SetMeshBlockSizevoid
# SetMeshBlockSize
C#
public void SetMeshBlockSize(uint size);
Parameters
NameTypeDefault
sizeuint—
TrySetBlockDatabool
# TrySetBlockData
C#
public bool TrySetBlockData(Vector3I position, VoxelBuffer voxels);
Parameters
NameTypeDefault
positionVector3I—
voxelsVoxelBuffer—
Returns bool
VoxelToDataBlockVector3I
# VoxelToDataBlock
C#
public Vector3I VoxelToDataBlock(Vector3 voxelPos);
Parameters
NameTypeDefault
voxelPosVector3—
Returns Vector3I
_OnAreaEditedvoid
# _OnAreaEdited
C#
public virtual void _OnAreaEdited(Vector3I areaOrigin, Vector3I areaSize);
Parameters
NameTypeDefault
areaOriginVector3I—
areaSizeVector3I—
_OnDataBlockEnteredvoid
# _OnDataBlockEntered
C#
public virtual void _OnDataBlockEntered(VoxelDataBlockEnterInfo info);
Parameters
NameTypeDefault
infoVoxelDataBlockEnterInfo—

Signals and events4

BlockLoadedEvent
# BlockLoaded
C#
public event VoxelTerrain.BlockLoadedEventHandler BlockLoaded;

Emitted when a new data block is loaded from stream. This can happen before the mesh or collider becomes available.

Handler parameters
NameTypeDefault
positionVector3I—
BlockUnloadedEvent
# BlockUnloaded
C#
public event VoxelTerrain.BlockUnloadedEventHandler BlockUnloaded;

Emitted when a data block is unloaded due to being outside view distance.

Handler parameters
NameTypeDefault
positionVector3I—
MeshBlockEnteredEvent
# MeshBlockEntered
C#
public event VoxelTerrain.MeshBlockEnteredEventHandler MeshBlockEntered;

Emitted when a mesh block receives its first update since it was added in the range of viewers. This is regardless of the mesh being empty or not. It tracks changes of the same state obtained with VoxelTerrain.IsAreaMeshed.

Handler parameters
NameTypeDefault
positionVector3I—
MeshBlockExitedEvent
# MeshBlockExited
C#
public event VoxelTerrain.MeshBlockExitedEventHandler MeshBlockExited;

Emitted when a mesh block gets unloaded. It is the counterpart of VoxelTerrain.MeshBlockEntered.

Handler parameters
NameTypeDefault
positionVector3I—

VoxelTerrain.DebugDrawFlag

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.