Struct SpatialFieldInfo
Describes the spatial index field on a component: its layout within the component data, the type of spatial bounds, and the index parameters (margin, cell size). Stored in SpatialIndexState and set at component registration time.
public readonly struct SpatialFieldInfo
- Inherited Members
Constructors
SpatialFieldInfo(int, int, SpatialFieldType, float, float, SpatialMode, uint)
Describe a component's spatial bounds field and its index parameters.
public SpatialFieldInfo(int fieldOffset, int fieldSize, SpatialFieldType fieldType, float margin, float cellSize, SpatialMode mode = SpatialMode.Dynamic, uint category = 4294967295)
Parameters
fieldOffsetintByte offset of the bounds field within the component data.
fieldSizeintSize, in bytes, of the bounds field.
fieldTypeSpatialFieldTypeKind of bounds stored (dimensionality + precision).
marginfloatFat-AABB margin in world units added around tight bounds.
cellSizefloatGrid cell size in world units; InverseCellSize is derived from it.
modeSpatialModecategoryuintArchetype-level category bitmask; defaults to MaxValue (matches any query mask).
Fields
Category
Archetype-level category bitmask from Category. Used by the per-cell cluster spatial broadphase to skip clusters whose category does not intersect the query's category mask. Defaults to MaxValue so archetypes without an explicit category remain queryable with any mask. Issue #230 Phase 3.
public readonly uint Category
Field Value
CellSize
Grid cell size, in world units, used to bucket this field's entities.
public readonly float CellSize
Field Value
FieldOffset
Byte offset of the spatial bounds field within the component's data.
public readonly int FieldOffset
Field Value
FieldSize
Size, in bytes, of the spatial bounds field.
public readonly int FieldSize
Field Value
FieldType
Kind of spatial bounds stored in the field (dimensionality + precision).
public readonly SpatialFieldType FieldType
Field Value
InverseCellSize
public readonly float InverseCellSize
Field Value
Margin
Fat-AABB margin, in world units, added around an entity's tight bounds so small movements don't force an index update.
public readonly float Margin
Field Value
Mode
public readonly SpatialMode Mode
Field Value
Properties
IsSphere
Returns true if this field type stores a bounding sphere (requires AABB conversion at tree update time).
public bool IsSphere { get; }
Property Value
Methods
ToVariant()
Map this field type to the corresponding R-Tree variant (dimensionality + precision).
public SpatialVariant ToVariant()