Class GridWorld
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
spatialGridCellSizeintOptional 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
MaxGrids
Maximum number of grids that can be managed within a world.
public const ushort MaxGrids = 65534
Field Value
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
IsActive
Indicates whether this world is currently active.
public bool IsActive { get; }
Property Value
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
SpawnToken
Nonzero process-unique 64-bit runtime allocation token for this active world. Zero indicates an inactive world.
public long SpawnToken { get; }
Property Value
Version
The current version of the world, incremented on major changes.
public uint Version { get; }
Property Value
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
cursorGridBoundaryContactCursorThe caller-owned cursor previously begun through this world.
resultsSpan<GridBoundaryContact>Caller-owned storage for contacts and their normalized grid identities.
candidateProbeLimitintThe maximum pair, source-address, and target probes for this chunk.
outputLimitintThe maximum contacts to write during this chunk.
candidateProbesConsumedintThe exact number of candidate probes consumed by this chunk.
outputCountintThe 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
cursorGridBoundaryContactCursorThe caller-owned cursor previously begun through this world.
resultsSpan<VoxelContactManifold>Caller-owned storage for contacts emitted by this chunk.
candidateProbeLimitintThe maximum pair, source-address, and target probes for this chunk.
outputLimitintThe maximum contacts to write during this chunk.
candidateProbesConsumedintThe exact number of candidate probes consumed by this chunk.
outputCountintThe 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
cursorGridCoveredAddressCursorThe cursor previously begun through this world.
generationInputsReadOnlySpan<GridCoveredAddressGeneration>The next strictly ascending remaining generation slice, or empty after binding completes.
resultsSpan<GridCoveredAddress>Caller-owned output storage.
lookupProbeLimitintMaximum generation-validation and spatial lookup probes for this chunk.
addressProbeLimitintMaximum topology-address probes for this chunk.
outputLimitintMaximum covered addresses to write for this chunk.
lookupProbesConsumedintExact lookup probes consumed by this chunk.
addressProbesConsumedintExact topology-address probes consumed by this chunk.
generationInputsConsumedintGeneration values consumed from the supplied slice.
outputCountintCovered 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
cursorGridBoundaryContactCursorThe 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
maintenanceActionThe 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
targetGridVoxelGrid
Returns
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
targetGridVoxelGridThe grid whose expanded topology bounds define the overlap query.
resultsSwiftList<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
Reset(bool)
Clears all grids and spatial data owned by this world.
public void Reset(bool deactivate = false)
Parameters
deactivateboolIf 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
configurationGridConfigurationThe grid configuration to normalize and register.
configuredVoxelsbool[,,]A [x, y, z] mask whose true values identify sparse voxels to materialize. Sparse masks must match the normalized grid dimensions.
allocatedIndexushortThe 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
configurationGridConfigurationThe grid configuration to normalize and register.
configuredVoxelsIEnumerable<VoxelIndex>Grid-local voxel indices to materialize for sparse storage.
allocatedIndexushortThe 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
configurationGridConfigurationThe grid configuration to normalize and register.
allocatedIndexushortThe 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
configurationKeyGridConfigurationKeyThe exact normalized configuration identity to resolve.
cursorGridBoundaryContactCursorThe 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
cursorGridCoveredAddressCursorThe caller-owned cursor and preallocated generation storage.
boundsMinVector3dOne world-space corner of the coverage bounds.
boundsMaxVector3dThe opposite world-space corner of the coverage bounds.
eligibleGenerationCountintThe 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
cursorGridCoveredAddressCursorThe caller-owned cursor and preallocated generation storage.
boundsMinVector3dOne world-space corner of the coverage bounds.
boundsMaxVector3dThe opposite world-space corner of the coverage bounds.
eligibleGenerationCountintThe exact number of canonical generation inputs that will follow.
configurationFilterGridConfigurationKeyThe 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
configurationKeyGridConfigurationKeyThe exact normalized configuration identity to resolve.
requestedVoxelsReadOnlySpan<VoxelIndex>Strictly ascending, unique, in-bounds topology-local addresses.
baselineGridNavigationBaselineThe 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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to resolve. Defaults to zero when omitted by paired overloads.
outGridVoxelGridThe closest grid, if found.
topologyKindGridTopologyKind?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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
outGridVoxelGridThe closest grid, if found.
topologyKindGridTopologyKind?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
positionVector3dThe world position to resolve.
outGridVoxelGridThe closest grid, if found.
topologyKindGridTopologyKind?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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to resolve. Defaults to zero when omitted by paired overloads.
outGridVoxelGridThe grid that owns the closest physical voxel, if found.
outVoxelVoxelThe closest physical voxel, if found.
topologyKindGridTopologyKind?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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
outGridVoxelGridThe grid that owns the closest physical voxel, if found.
outVoxelVoxelThe closest physical voxel, if found.
topologyKindGridTopologyKind?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
positionVector3dThe world position to resolve.
outGridVoxelGridThe grid that owns the closest physical voxel, if found.
outVoxelVoxelThe closest physical voxel, if found.
topologyKindGridTopologyKind?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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to resolve. Defaults to zero when omitted by paired overloads.
resultVoxelThe closest physical voxel, if found.
topologyKindGridTopologyKind?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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
resultVoxelThe closest physical voxel, if found.
topologyKindGridTopologyKind?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
positionVector3dThe world position to resolve.
resultVoxelThe closest physical voxel, if found.
topologyKindGridTopologyKind?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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to resolve. Defaults to zero when omitted by paired overloads.
outGridVoxelGridThe 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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
outGridVoxelGridThe 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
positionVector3dThe world position to resolve.
outGridVoxelGridThe 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
worldVoxelIndexWorldVoxelIndexThe voxel identity whose grid should be resolved.
resultVoxelGridThe 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
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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to resolve. Defaults to zero when omitted by paired overloads.
outGridVoxelGridThe resolved grid, if found.
outVoxelVoxelThe 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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
outGridVoxelGridThe resolved grid, if found.
outVoxelVoxelThe 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
positionVector3dThe world position to resolve.
outGridVoxelGridThe resolved grid, if found.
outVoxelVoxelThe 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
worldVoxelIndexWorldVoxelIndexThe voxel identity to resolve.
outGridVoxelGridThe resolved grid, if found.
resultVoxelThe 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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
layerYFixed64The world Y layer to resolve. Defaults to zero when omitted by paired overloads.
resultVoxelThe 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
positionVector2dThe 2D position whose X component maps to world X and Y component maps to world Z.
resultVoxelThe 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
positionVector3dThe world position to resolve.
resultVoxelThe 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
worldVoxelIndexWorldVoxelIndexThe voxel identity to resolve.
resultVoxelThe 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
removeIndexushortThe 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
OnActiveGridChange
Event triggered when a grid in this world undergoes a significant change.
public event Action<GridEventInfo> OnActiveGridChange
Event Type
OnActiveGridRemoved
Event triggered when a grid is removed from this world.
public event Action<GridEventInfo> OnActiveGridRemoved
Event Type
OnChangeCommitted
Receives every committed grid lifecycle, sparse-presence, and obstacle mutation in ascending ChangeSequence order.
public event Action<GridEventInfo> OnChangeCommitted
Event Type
OnReset
Event triggered when this world is reset.
public event Action OnReset