Table of Contents

Class GridWorld

Namespace
GridForge.Grids
Assembly
GridForge.dll

Owns the mutable runtime state for one GridForge world.

public sealed class GridWorld : IDisposable
Inheritance
GridWorld
Implements
Inherited Members

Constructors

GridWorld(int)

Initializes a new world with optional ordinary-grid lookup tuning.

public GridWorld(int spatialGridCellSize = 50)

Parameters

spatialGridCellSize int

Optional ordinary-grid lookup cell size for this world.

Fields

DefaultRectangularCellSize

The default rectangular cell edge in world units.

public static readonly Fixed64 DefaultRectangularCellSize

Field Value

Fixed64

DefaultSpatialGridCellSize

The default cell size used to tune ordinary-grid lookup. Oversized grids are indexed automatically outside this tier.

public const int DefaultSpatialGridCellSize = 50

Field Value

int

MaxGrids

Maximum number of grids that can be managed within a world.

public const ushort MaxGrids = 65534

Field Value

ushort

Properties

ActiveGrids

Collection of all active grids owned by this world.

public SwiftBucket<VoxelGrid> ActiveGrids { get; }

Property Value

SwiftBucket<VoxelGrid>

BoundsTracker

Dictionary mapping exact grid configuration keys to grid indices to prevent duplicate grids.

public SwiftDictionary<GridConfigurationKey, ushort> BoundsTracker { get; }

Property Value

SwiftDictionary<GridConfigurationKey, ushort>

ChangeSequence

The most recent world-local committed change sequence.

public ulong ChangeSequence { get; }

Property Value

ulong

IsActive

Indicates whether this world is currently active.

public bool IsActive { get; }

Property Value

bool

SpatialGridCellSize

The cell size used to tune ordinary-grid lookup in this world. Oversized grids are indexed automatically outside this tier.

public int SpatialGridCellSize { get; }

Property Value

int

SpawnToken

Nonzero process-unique 64-bit runtime allocation token for this active world. Zero indicates an inactive world.

public long SpawnToken { get; }

Property Value

long

Version

The current version of the world, incremented on major changes.

public uint Version { get; }

Property Value

uint

Methods

AdvanceBoundaryContacts(GridBoundaryContactCursor, Span<GridBoundaryContact>, int, int, out int, out int)

Advances a bounded exact boundary-contact query and emits durable grid identities with each contact.

public GridBoundaryContactCursorStatus AdvanceBoundaryContacts(GridBoundaryContactCursor cursor, Span<GridBoundaryContact> results, int candidateProbeLimit, int outputLimit, out int candidateProbesConsumed, out int outputCount)

Parameters

cursor GridBoundaryContactCursor

The caller-owned cursor previously begun through this world.

results Span<GridBoundaryContact>

Caller-owned storage for contacts and their normalized grid identities.

candidateProbeLimit int

The maximum pair, source-address, and target probes for this chunk.

outputLimit int

The maximum contacts to write during this chunk.

candidateProbesConsumed int

The exact number of candidate probes consumed by this chunk.

outputCount int

The number of contacts written to results.

Returns

GridBoundaryContactCursorStatus

The resulting cursor state.

Remarks

Every emitted identity belongs to RunStamp. A stale result writes no contacts and resets that stamp to its default value.

AdvanceBoundaryContacts(GridBoundaryContactCursor, Span<VoxelContactManifold>, int, int, out int, out int)

Advances a bounded exact boundary-contact query under one short navigation-maintenance snapshot.

public GridBoundaryContactCursorStatus AdvanceBoundaryContacts(GridBoundaryContactCursor cursor, Span<VoxelContactManifold> results, int candidateProbeLimit, int outputLimit, out int candidateProbesConsumed, out int outputCount)

Parameters

cursor GridBoundaryContactCursor

The caller-owned cursor previously begun through this world.

results Span<VoxelContactManifold>

Caller-owned storage for contacts emitted by this chunk.

candidateProbeLimit int

The maximum pair, source-address, and target probes for this chunk.

outputLimit int

The maximum contacts to write during this chunk.

candidateProbesConsumed int

The exact number of candidate probes consumed by this chunk.

outputCount int

The number of contacts written to results.

Returns

GridBoundaryContactCursorStatus

The resulting cursor state.

Remarks

A Stale result writes no contacts and resets the cursor ordinal. The caller must discard every contact returned since the preceding begin. Completed cursors remain bound and are revalidated on every later call, including zero-budget calls.

AdvanceCoveredAddresses(GridCoveredAddressCursor, ReadOnlySpan<GridCoveredAddressGeneration>, Span<GridCoveredAddress>, int, int, int, out int, out int, out int, out int)

Advances generation binding and covered topology-address enumeration under one maintenance snapshot.

public GridCoveredAddressCursorStatus AdvanceCoveredAddresses(GridCoveredAddressCursor cursor, ReadOnlySpan<GridCoveredAddressGeneration> generationInputs, Span<GridCoveredAddress> results, int lookupProbeLimit, int addressProbeLimit, int outputLimit, out int lookupProbesConsumed, out int addressProbesConsumed, out int generationInputsConsumed, out int outputCount)

Parameters

cursor GridCoveredAddressCursor

The cursor previously begun through this world.

generationInputs ReadOnlySpan<GridCoveredAddressGeneration>

The next strictly ascending remaining generation slice, or empty after binding completes.

results Span<GridCoveredAddress>

Caller-owned output storage.

lookupProbeLimit int

Maximum generation-validation and spatial lookup probes for this chunk.

addressProbeLimit int

Maximum topology-address probes for this chunk.

outputLimit int

Maximum covered addresses to write for this chunk.

lookupProbesConsumed int

Exact lookup probes consumed by this chunk.

addressProbesConsumed int

Exact topology-address probes consumed by this chunk.

generationInputsConsumed int

Generation values consumed from the supplied slice.

outputCount int

Covered addresses written to results.

Returns

GridCoveredAddressCursorStatus

The resulting cursor state.

Remarks

No address can be emitted until every declared generation has been validated and copied. A stale result writes no output, clears the run stamp, and requires every prior result from the run to be discarded. Address enumeration does not resolve physical voxel presence or obstacle state. Hex-prism coverage includes cells touching the inclusive query bounds at either vertical face.

AllocateObstacleToken()

Allocates a nonzero process-unique identity for one obstacle registration lifetime.

public ObstacleToken AllocateObstacleToken()

Returns

ObstacleToken

A fresh opaque obstacle token.

Exceptions

InvalidOperationException

The world is inactive or its token space is exhausted.

BeginBoundaryContacts(GridBoundaryContactCursor)

Begins or restarts a bounded exact boundary-contact query against the current committed world state.

public void BeginBoundaryContacts(GridBoundaryContactCursor cursor)

Parameters

cursor GridBoundaryContactCursor

The caller-owned cursor to reset and bind.

Dispose()

public void Dispose()

ExecuteNavigationMaintenanceSnapshot(Action)

Executes one short navigation maintenance snapshot while grid mutations are frozen. Committed-change prefix detachment and all required navigation baseline captures can therefore observe one deterministic world state.

public void ExecuteNavigationMaintenanceSnapshot(Action maintenance)

Parameters

maintenance Action

The non-mutating maintenance callback to execute.

Remarks

The callback may call TryCaptureNavigationBaseline(GridConfigurationKey, ReadOnlySpan<VoxelIndex>, out GridNavigationBaseline?) without lock recursion. It must not mutate this world, wait for code that may mutate this world, or retain live grid/voxel references beyond the callback. This method must not be called from a committed- change notification handler. Those handlers remain outside the mutation lock and may enqueue represented events after this snapshot completes.

FindOverlappingGrids(VoxelGrid)

Finds active grids in this world that overlap the supplied target grid.

public IEnumerable<VoxelGrid> FindOverlappingGrids(VoxelGrid targetGrid)

Parameters

targetGrid VoxelGrid

Returns

IEnumerable<VoxelGrid>

FindOverlappingGridsInto(VoxelGrid, SwiftList<VoxelGrid>)

Clears and fills caller-owned storage with active grids that overlap the supplied target grid.

public void FindOverlappingGridsInto(VoxelGrid targetGrid, SwiftList<VoxelGrid> results)

Parameters

targetGrid VoxelGrid

The grid whose expanded topology bounds define the overlap query.

results SwiftList<VoxelGrid>

Caller-owned storage cleared and filled in ascending grid-slot order.

IncrementGridVersion(int, bool)

Increments the version of the specified grid and optionally the world version.

public void IncrementGridVersion(int index, bool significant = false)

Parameters

index int
significant bool

Reset(bool)

Clears all grids and spatial data owned by this world.

public void Reset(bool deactivate = false)

Parameters

deactivate bool

If true, marks the world inactive and releases its event handlers.

TryAddGrid(GridConfiguration, bool[,,]?, out ushort)

Adds a new grid to this world and materializes true cells from the supplied sparse voxel mask when sparse storage is configured. Dense grids ignore the configured voxel input and materialize every in-bounds voxel.

public bool TryAddGrid(GridConfiguration configuration, bool[,,]? configuredVoxels, out ushort allocatedIndex)

Parameters

configuration GridConfiguration

The grid configuration to normalize and register.

configuredVoxels bool[,,]

A [x, y, z] mask whose true values identify sparse voxels to materialize. Sparse masks must match the normalized grid dimensions.

allocatedIndex ushort

The allocated world-local grid slot on success.

Returns

bool

True if the grid was added; otherwise false.

TryAddGrid(GridConfiguration, IEnumerable<VoxelIndex>?, out ushort)

Adds a new grid to this world and materializes the supplied sparse voxel indices when sparse storage is configured. Dense grids ignore the configured voxel input and materialize every in-bounds voxel.

public bool TryAddGrid(GridConfiguration configuration, IEnumerable<VoxelIndex>? configuredVoxels, out ushort allocatedIndex)

Parameters

configuration GridConfiguration

The grid configuration to normalize and register.

configuredVoxels IEnumerable<VoxelIndex>

Grid-local voxel indices to materialize for sparse storage.

allocatedIndex ushort

The allocated world-local grid slot on success.

Returns

bool

True if the grid was added; otherwise false.

TryAddGrid(GridConfiguration, out ushort)

Adds a new grid to this world and registers it in the spatial index.

public bool TryAddGrid(GridConfiguration configuration, out ushort allocatedIndex)

Parameters

configuration GridConfiguration

The grid configuration to normalize and register.

allocatedIndex ushort

The allocated world-local grid slot on success.

Returns

bool

True if the grid was added; otherwise false.

TryBeginBoundaryContacts(GridConfigurationKey, GridBoundaryContactCursor)

Begins or restarts a bounded exact boundary-contact query restricted to one active grid.

public bool TryBeginBoundaryContacts(GridConfigurationKey configurationKey, GridBoundaryContactCursor cursor)

Parameters

configurationKey GridConfigurationKey

The exact normalized configuration identity to resolve.

cursor GridBoundaryContactCursor

The caller-owned cursor to reset and bind.

Returns

bool

True when the requested active grid was bound; otherwise false.

TryBeginCoveredAddresses(GridCoveredAddressCursor, Vector3d, Vector3d, int)

Begins a bounded covered-address query for a declared number of exact eligible grid generations.

public bool TryBeginCoveredAddresses(GridCoveredAddressCursor cursor, Vector3d boundsMin, Vector3d boundsMax, int eligibleGenerationCount)

Parameters

cursor GridCoveredAddressCursor

The caller-owned cursor and preallocated generation storage.

boundsMin Vector3d

One world-space corner of the coverage bounds.

boundsMax Vector3d

The opposite world-space corner of the coverage bounds.

eligibleGenerationCount int

The exact number of canonical generation inputs that will follow.

Returns

bool

True when the declared count fits the cursor; otherwise false and the cursor is stale.

TryBeginCoveredAddresses(GridCoveredAddressCursor, Vector3d, Vector3d, int, GridConfigurationKey)

Begins a bounded covered-address query filtered to one durable grid configuration before address yield.

public bool TryBeginCoveredAddresses(GridCoveredAddressCursor cursor, Vector3d boundsMin, Vector3d boundsMax, int eligibleGenerationCount, GridConfigurationKey configurationFilter)

Parameters

cursor GridCoveredAddressCursor

The caller-owned cursor and preallocated generation storage.

boundsMin Vector3d

One world-space corner of the coverage bounds.

boundsMax Vector3d

The opposite world-space corner of the coverage bounds.

eligibleGenerationCount int

The exact number of canonical generation inputs that will follow.

configurationFilter GridConfigurationKey

The only configuration eligible to produce addresses.

Returns

bool

True when the declared count fits the cursor; otherwise false and the cursor is stale.

TryCaptureNavigationBaseline(GridConfigurationKey, ReadOnlySpan<VoxelIndex>, out GridNavigationBaseline?)

Captures presence and obstacle state for a sorted requested address span without enumerating unrelated grids or unrequested physical voxels.

public bool TryCaptureNavigationBaseline(GridConfigurationKey configurationKey, ReadOnlySpan<VoxelIndex> requestedVoxels, out GridNavigationBaseline? baseline)

Parameters

configurationKey GridConfigurationKey

The exact normalized configuration identity to resolve.

requestedVoxels ReadOnlySpan<VoxelIndex>

Strictly ascending, unique, in-bounds topology-local addresses.

baseline GridNavigationBaseline

The atomic baseline on success.

Returns

bool

True when the requested active grid generation was captured; otherwise false.

TryGetClosestGrid(Vector2d, Fixed64, out VoxelGrid?, GridTopologyKind?)

Retrieves the active grid whose bounds are nearest to a 2D XZ-plane world position on the supplied world Y layer.

public bool TryGetClosestGrid(Vector2d position, Fixed64 layerY, out VoxelGrid? outGrid, GridTopologyKind? topologyKind = null)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

layerY Fixed64

The world Y layer to resolve. Defaults to zero when omitted by paired overloads.

outGrid VoxelGrid

The closest grid, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a closest active grid was resolved; otherwise false.

TryGetClosestGrid(Vector2d, out VoxelGrid?, GridTopologyKind?)

Retrieves the active grid whose bounds are nearest to a 2D XZ-plane world position on the default world Y layer.

public bool TryGetClosestGrid(Vector2d position, out VoxelGrid? outGrid, GridTopologyKind? topologyKind = null)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

outGrid VoxelGrid

The closest grid, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a closest active grid was resolved; otherwise false.

TryGetClosestGrid(Vector3d, out VoxelGrid?, GridTopologyKind?)

Retrieves the active grid whose bounds are nearest to the supplied world position.

public bool TryGetClosestGrid(Vector3d position, out VoxelGrid? outGrid, GridTopologyKind? topologyKind = null)

Parameters

position Vector3d

The world position to resolve.

outGrid VoxelGrid

The closest grid, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a closest active grid was resolved; otherwise false.

TryGetClosestGridAndVoxel(Vector2d, Fixed64, out VoxelGrid?, out Voxel?, GridTopologyKind?)

Retrieves the physical voxel whose center is nearest to a 2D XZ-plane world position on the supplied world Y layer and the grid that owns it. Sparse grids only consider configured physical voxels.

public bool TryGetClosestGridAndVoxel(Vector2d position, Fixed64 layerY, out VoxelGrid? outGrid, out Voxel? outVoxel, GridTopologyKind? topologyKind = null)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

layerY Fixed64

The world Y layer to resolve. Defaults to zero when omitted by paired overloads.

outGrid VoxelGrid

The grid that owns the closest physical voxel, if found.

outVoxel Voxel

The closest physical voxel, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a physical voxel was resolved; otherwise false.

TryGetClosestGridAndVoxel(Vector2d, out VoxelGrid?, out Voxel?, GridTopologyKind?)

Retrieves the physical voxel whose center is nearest to a 2D XZ-plane world position on the default world Y layer and the grid that owns it. Sparse grids only consider configured physical voxels.

public bool TryGetClosestGridAndVoxel(Vector2d position, out VoxelGrid? outGrid, out Voxel? outVoxel, GridTopologyKind? topologyKind = null)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

outGrid VoxelGrid

The grid that owns the closest physical voxel, if found.

outVoxel Voxel

The closest physical voxel, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a physical voxel was resolved; otherwise false.

TryGetClosestGridAndVoxel(Vector3d, out VoxelGrid?, out Voxel?, GridTopologyKind?)

Retrieves the physical voxel whose center is nearest to the supplied world position and the grid that owns it. Sparse grids only consider configured physical voxels.

public bool TryGetClosestGridAndVoxel(Vector3d position, out VoxelGrid? outGrid, out Voxel? outVoxel, GridTopologyKind? topologyKind = null)

Parameters

position Vector3d

The world position to resolve.

outGrid VoxelGrid

The grid that owns the closest physical voxel, if found.

outVoxel Voxel

The closest physical voxel, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a physical voxel was resolved; otherwise false.

TryGetClosestVoxel(Vector2d, Fixed64, out Voxel?, GridTopologyKind?)

Retrieves the physical voxel whose center is nearest to a 2D XZ-plane world position on the supplied world Y layer. Sparse grids only consider configured physical voxels.

public bool TryGetClosestVoxel(Vector2d position, Fixed64 layerY, out Voxel? result, GridTopologyKind? topologyKind = null)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

layerY Fixed64

The world Y layer to resolve. Defaults to zero when omitted by paired overloads.

result Voxel

The closest physical voxel, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a physical voxel was resolved; otherwise false.

TryGetClosestVoxel(Vector2d, out Voxel?, GridTopologyKind?)

Retrieves the physical voxel whose center is nearest to a 2D XZ-plane world position on the default world Y layer. Sparse grids only consider configured physical voxels.

public bool TryGetClosestVoxel(Vector2d position, out Voxel? result, GridTopologyKind? topologyKind = null)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

result Voxel

The closest physical voxel, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a physical voxel was resolved; otherwise false.

TryGetClosestVoxel(Vector3d, out Voxel?, GridTopologyKind?)

Retrieves the physical voxel whose center is nearest to the supplied world position. Sparse grids only consider configured physical voxels.

public bool TryGetClosestVoxel(Vector3d position, out Voxel? result, GridTopologyKind? topologyKind = null)

Parameters

position Vector3d

The world position to resolve.

result Voxel

The closest physical voxel, if found.

topologyKind GridTopologyKind?

Optional topology filter. When supplied, only grids using the requested topology are considered.

Returns

bool

True if a physical voxel was resolved; otherwise false.

TryGetGrid(Vector2d, Fixed64, out VoxelGrid?)

Retrieves the grid containing a 2D XZ-plane world position on the supplied world Y layer.

public bool TryGetGrid(Vector2d position, Fixed64 layerY, out VoxelGrid? outGrid)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

layerY Fixed64

The world Y layer to resolve. Defaults to zero when omitted by paired overloads.

outGrid VoxelGrid

The resolved grid, if found.

Returns

bool

True if a containing grid was found; otherwise false.

TryGetGrid(Vector2d, out VoxelGrid?)

Retrieves the grid containing a 2D XZ-plane world position on the default world Y layer.

public bool TryGetGrid(Vector2d position, out VoxelGrid? outGrid)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

outGrid VoxelGrid

The resolved grid, if found.

Returns

bool

True if a containing grid was found; otherwise false.

TryGetGrid(Vector3d, out VoxelGrid?)

Retrieves the grid containing a given world position.

public bool TryGetGrid(Vector3d position, out VoxelGrid? outGrid)

Parameters

position Vector3d

The world position to resolve.

outGrid VoxelGrid

The resolved grid, if found.

Returns

bool

True if a containing grid was found; otherwise false.

TryGetGrid(WorldVoxelIndex, out VoxelGrid?)

Retrieves a grid by a world-scoped voxel identity.

public bool TryGetGrid(WorldVoxelIndex worldVoxelIndex, out VoxelGrid? result)

Parameters

worldVoxelIndex WorldVoxelIndex

The voxel identity whose grid should be resolved.

result VoxelGrid

The resolved grid, if found.

Returns

bool

True if the grid was resolved; otherwise false.

TryGetGrid(int, out VoxelGrid?)

Retrieves a grid by its world-local index.

public bool TryGetGrid(int index, out VoxelGrid? outGrid)

Parameters

index int

The world-local grid slot to resolve.

outGrid VoxelGrid

The resolved grid, if found.

Returns

bool

True if the grid was resolved; otherwise false.

TryGetGridAndVoxel(Vector2d, Fixed64, out VoxelGrid?, out Voxel?)

Retrieves the grid and voxel containing a 2D XZ-plane world position on the supplied world Y layer.

public bool TryGetGridAndVoxel(Vector2d position, Fixed64 layerY, out VoxelGrid? outGrid, out Voxel? outVoxel)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

layerY Fixed64

The world Y layer to resolve. Defaults to zero when omitted by paired overloads.

outGrid VoxelGrid

The resolved grid, if found.

outVoxel Voxel

The resolved voxel, if found.

Returns

bool

True if both the grid and voxel were resolved; otherwise false.

TryGetGridAndVoxel(Vector2d, out VoxelGrid?, out Voxel?)

Retrieves the grid and voxel containing a 2D XZ-plane world position on the default world Y layer.

public bool TryGetGridAndVoxel(Vector2d position, out VoxelGrid? outGrid, out Voxel? outVoxel)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

outGrid VoxelGrid

The resolved grid, if found.

outVoxel Voxel

The resolved voxel, if found.

Returns

bool

True if both the grid and voxel were resolved; otherwise false.

TryGetGridAndVoxel(Vector3d, out VoxelGrid?, out Voxel?)

Retrieves the grid and voxel containing a given world position.

public bool TryGetGridAndVoxel(Vector3d position, out VoxelGrid? outGrid, out Voxel? outVoxel)

Parameters

position Vector3d

The world position to resolve.

outGrid VoxelGrid

The resolved grid, if found.

outVoxel Voxel

The resolved voxel, if found.

Returns

bool

True if both the grid and voxel were resolved; otherwise false.

TryGetGridAndVoxel(WorldVoxelIndex, out VoxelGrid?, out Voxel?)

Retrieves the grid and voxel for a given voxel identity.

public bool TryGetGridAndVoxel(WorldVoxelIndex worldVoxelIndex, out VoxelGrid? outGrid, out Voxel? result)

Parameters

worldVoxelIndex WorldVoxelIndex

The voxel identity to resolve.

outGrid VoxelGrid

The resolved grid, if found.

result Voxel

The resolved voxel, if found.

Returns

bool

True if both the grid and voxel were resolved; otherwise false.

TryGetVoxel(Vector2d, Fixed64, out Voxel?)

Retrieves a voxel from a 2D XZ-plane world position on the supplied world Y layer.

public bool TryGetVoxel(Vector2d position, Fixed64 layerY, out Voxel? result)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

layerY Fixed64

The world Y layer to resolve. Defaults to zero when omitted by paired overloads.

result Voxel

The resolved voxel, if found.

Returns

bool

True if the voxel was resolved; otherwise false.

TryGetVoxel(Vector2d, out Voxel?)

Retrieves a voxel from a 2D XZ-plane world position on the default world Y layer.

public bool TryGetVoxel(Vector2d position, out Voxel? result)

Parameters

position Vector2d

The 2D position whose X component maps to world X and Y component maps to world Z.

result Voxel

The resolved voxel, if found.

Returns

bool

True if the voxel was resolved; otherwise false.

TryGetVoxel(Vector3d, out Voxel?)

Retrieves a voxel from a world position.

public bool TryGetVoxel(Vector3d position, out Voxel? result)

Parameters

position Vector3d

The world position to resolve.

result Voxel

The resolved voxel, if found.

Returns

bool

True if the voxel was resolved; otherwise false.

TryGetVoxel(WorldVoxelIndex, out Voxel?)

Retrieves a voxel from a world-scoped voxel identity.

public bool TryGetVoxel(WorldVoxelIndex worldVoxelIndex, out Voxel? result)

Parameters

worldVoxelIndex WorldVoxelIndex

The voxel identity to resolve.

result Voxel

The resolved voxel, if found.

Returns

bool

True if the voxel was resolved; otherwise false.

TryRemoveGrid(ushort)

Removes a grid from this world and updates all references to ensure integrity.

public bool TryRemoveGrid(ushort removeIndex)

Parameters

removeIndex ushort

The world-local grid slot to remove.

Returns

bool

True if the grid was removed; otherwise false.

Events

OnActiveGridAdded

Event triggered when a new grid is added to this world.

public event Action<GridEventInfo> OnActiveGridAdded

Event Type

Action<GridEventInfo>

OnActiveGridChange

Event triggered when a grid in this world undergoes a significant change.

public event Action<GridEventInfo> OnActiveGridChange

Event Type

Action<GridEventInfo>

OnActiveGridRemoved

Event triggered when a grid is removed from this world.

public event Action<GridEventInfo> OnActiveGridRemoved

Event Type

Action<GridEventInfo>

OnChangeCommitted

Receives every committed grid lifecycle, sparse-presence, and obstacle mutation in ascending ChangeSequence order.

public event Action<GridEventInfo> OnChangeCommitted

Event Type

Action<GridEventInfo>

OnReset

Event triggered when this world is reset.

public event Action OnReset

Event Type

Action