API reference
API reference
Select your platform
No SDKs available
No versions available

com.meta.spatial.core

Package-level declarations

Types

NameSummary
interface AbstractAttribute

Interface for attributes that can be stored in components.
data class AttributeInfo(val type: RegisteredAttributeType, val name: String, val componentId: Int, val enumClass: Class<out Enum<*>>? = null)

Data Class that holds printable data of registered attributes. Used in ComponentManager.
data class AttributeInfoMap(val map: Map<Int, AttributeInfo> = mapOf(), val version: Int = 0)

Data Class that holds a map of Attribute ID to Attribute Info. Version is bumped when it changes. Used in ComponentManager.
typealias AttributeListener = (entity: Entity, dataModel: DataModel, attribute: Int, packet: Any?) -> Unit

Callback method that is run when the defined attribute is changed
enum AttributePrimitive : Enum<AttributePrimitive>

Enum class representing different types of attribute implementations in the native layer.
class BooleanAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: Boolean) : TypedAbstractAttribute<Boolean>

An attribute that stores a Boolean value.
data class BooleanAttributeData(val id: Int)

Data Class that holds the unique attribute id for a BooleanAttribute
data class Bound2D(var min: Vector2 = Vector2(0f, 0f), var max: Vector2 = Vector2(0f, 0f))

A data class representing a 2D bounding box.
data class Bound3D(var min: Vector3 = Vector3(0f, 0f, 0f), var max: Vector3 = Vector3(0f, 0f, 0f))

Represents a 3D bounding box with minimum and maximum coordinates.
class ByBooleanFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for boolean attributes. It is used to build a filter expression by specifying equality operations on boolean attribute values.
class ByEntityAttributeFilterNode(val attrId: Int, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for Entity values.
class ByEntityFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for Entity attributes. It is used to build a filter expression by specifying equality operations on Entity attribute values.
class ByEnumFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for Enum attributes. It is used to build a filter expression by specifying comparison and pattern matching operations on string attribute values.
class ByFloatFilterNode(attrId: Int, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for float values.
class ByFloatFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for float attributes. It is used to build a filter expression by specifying comparison operations on float attribute values.
class ByIntFilterNode(attrId: Int, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for integer values.
class ByIntFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for integer attributes. It is used to build a filter expression by specifying filter operation and its operands.
class ByLongFilterNode(attrId: Int, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for long integer values.
class ByLongFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for long integer attributes. It is used to build a filter expression by specifying comparison operations on long integer attributes.
class ByMapFilterNode<KeyType, ValueType>(val attrId: Int, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for Map values.
class ByMapFilterOperation<KeyType, ValueType>(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for Map attributes. It is used to build a filter expression by specifying key-based operations on Map attribute values.
class ByPoseFilterNode(attrId: Int, propId: Int, filterNodeType: FilterNodeType = FilterNodeType.FILTER, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for Pose values.
class ByPoseFilterOperation(val attrId: Int, var propId: Int = 0, val filterBuilder: FilterBuilder)

A class representing a filter operation for Pose attributes. It is used to build a filter expression by specifying comparison operations on Pose attribute values.
class ByStringFilterNode(attrId: Int, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for String values.
class ByStringFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for string attributes. It is used to build a filter expression by specifying comparison and pattern matching operations on string attribute values.
class ByTimeAttributeFilterNode(val attrId: Int, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for Time values.
class ByTimeFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for Time attributes. It is used to build a filter expression by specifying comparison operations on Time attribute values.
class ByUUIDFilterNode(attrId: Int, filterNodeType: FilterNodeType = FilterNodeType.FILTER, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for UUID values.
class ByUUIDFilterOperation(val attrId: Int, val filterBuilder: FilterBuilder)

A class representing a filter operation for UUID attributes.
class ByVector2FilterNode(attrId: Int, propId: Int, filterNodeType: FilterNodeType = FilterNodeType.FILTER, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for Vector2 values.
class ByVector2FilterOperation(val attrId: Int, var propId: Int = 0, val filterBuilder: FilterBuilder)

A class representing a filter operation for Vector2 attributes. It is used to build a filter expression by specifying comparison operations on Vector2 attribute values.
class ByVector3FilterNode(attrId: Int, propId: Int, filterNodeType: FilterNodeType = FilterNodeType.FILTER, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for Vector3 values.
class ByVector3FilterOperation(val attrId: Int, var propId: Int = 0, val filterBuilder: FilterBuilder)

A class representing a filter operation for Vector3 attributes. It is used to build a filter expression by specifying comparison operations on Vector3 attribute values.
class ByVector4FilterNode(attrId: Int, propId: Int, filterNodeType: FilterNodeType = FilterNodeType.FILTER, val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for Vector4 values.
class ByVector4FilterOperation(val attrId: Int, var propId: Int = 0, val filterBuilder: FilterBuilder)

A class representing a filter operation for Vector4 attributes. It is used to build a filter expression by specifying comparison operations on Vector4 attribute values.
class Color3

Color3 is a class that represents a color in RGB space. It has three properties: red, green, and blue. These properties are floats that range from 0 to 1.
open class Color4

Color4 is a class that represents a color in RGBA space. It has four properties: red, green, blue, and alpha. These properties are floats that range from 0 to 1.
class Color4Attribute(keyString: String, key: Int, component: ComponentBase, initialValue: Color4) : TypedAbstractAttribute<Color4>

An attribute that stores a Color4 value.
data class Color4AttributeData(val id: Int)

Data Class that holds the unique attribute id for a Color4Attribute
abstract class ComponentBase

Base class for all components in the Spatial SDK entity-component system (ECS). See more: https://developers.meta.com/horizon/documentation/spatial-sdk/spatial-sdk-component
interface ComponentCompanion

An interface for component companion objects that provides metadata about components.
typealias ComponentListener = (entity: Entity, dataModel: DataModel, componentID: Int, component: ComponentBase, packet: Any?) -> Unit

Callback method that is run when the defined component is changed
class ComponentManager

Manages component registration, creation, and lifecycle in the Spatial SDK.
class ComponentRegistration(val clazz: KClass<out ComponentBase>, val companionObjectInstance: ComponentCompanion, val sendRate: SendRate = SendRate.DEFAULT)

ComponentRegistration is used to register components when creating a SpatialFeature. It is generally used and returned in a list in the SpatialFeature.componentsToRegister() method. It is recommeded to create a ComponentRegistration using the static createConfig() method.
class DataModel(dataModel_: Long)

DataModel is a class that manages data for Entities, Components, and Attributes in the Spatial SDK ECS architecture.
class Entity

Represents an entity in the spatial data model. Learn more about our Entity-Component-System (ECS) architecture here: https://developers.meta.com/horizon/documentation/spatial-sdk/spatial-sdk-ecs
class EntityAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: Entity) : TypedAbstractAttribute<Entity>

An attribute that stores an Entity reference.
data class EntityAttributeData(val id: Int)

Data Class that holds the unique attribute id for an EntityAttribute
object EntityContext

This class is a singleton that provides access to the SpatialSDK specific objects such as the DataModel, SystemManager, and ComponentManager.
interface EntityIterator : Iterator<Entity> , Closeable
class EntitySortCriterion(val attrId: Int) : SortCriterion

Represents a sorting criterion based on an Entity attribute.
class EnumAttribute<T : Enum<T>>(keyString: String, key: Int, component: ComponentBase, enumClass: Class<T>, initialValue: T) : TypedAbstractAttribute<T>

An attribute that stores an Enum value.
data class EnumAttributeData(val id: Int)

Data Class that holds the unique attribute id for an EnumAttribute
open class EventArgs(val eventName: String, val dataModel: DataModel, var handled: Boolean = false, var throttleTime: Int? = null)
typealias EventListener<T> = (entity: Entity, args: T) -> Unit

Callback method that is run for an entity when certain conditions are met
class ExperimentalMapAttribute<KeyT, ValT>(keyString: String, key: Int, component: ComponentBase) : AbstractAttribute

An attribute that stores a map of key-value pairs.
data class ExperimentalMapAttributeData<K, V>(val id: Int)

Data Class that holds the unique attribute id for an ExperimentalMapAttribute
class FeatureManager(val features: List<SpatialFeature>)

Manages a collection of com.meta.spatial.core.SpatialFeature instances for your Spatial SDK activity.
class FilterBuilder

A filtering system for refining entity queries in the Spatial SDK.
open class FilterNode(val type: FilterNodeType, val filterFunctionInfo: FilterFunctionInfo? = null, val filterBuilder: FilterBuilder)

A class representing a node in a filter tree.
enum FilterNodeType : Enum<FilterNodeType>

An enumeration representing the node type of a filter.
class FloatAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: Float) : TypedAbstractAttribute<Float>

An attribute that stores a Float value.
data class FloatAttributeData(val id: Int)

Data Class that holds the unique attribute id for a FloatAttribute
class FloatSortCriterion(val attrId: Int) : SortCriterion

Sort criterion based on float attribute.
enum Hand : Enum<Hand>

Represents the hand side in a spatial context.
class IntAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: Int) : TypedAbstractAttribute<Int>

An attribute that stores an Int value.
data class IntAttributeData(val id: Int)

Data Class that holds the unique attribute id for an IntAttribute
class IntSortCriterion(val attrId: Int) : SortCriterion

Sort criterion based on int attribute.
class IsLocalFilterNode(val filterBuilder: FilterBuilder) : FilterNode

A class representing a filter node for local entities.
class LongAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: Long) : TypedAbstractAttribute<Long>

An attribute that stores a Long value.
data class LongAttributeData(val id: Int)

Data Class that holds the unique attribute id for a LongAttribute
class LongSortCriterion(val attrId: Int) : SortCriterion

Sort criterion based on long attribute.
class Lut(val dimension: Int = 16)

Passthrough lookup tables (LUTs) transform the colors that passthrough displays. You can use them to evoke a certain style, such as tinting everything red when you are low on health, or to emulate a lighting environment, like dimming lights when a movie starts.
data class Matrix44(var m00: Float, var m01: Float, var m02: Float, var m03: Float, var m10: Float, var m11: Float, var m12: Float, var m13: Float, var m20: Float, var m21: Float, var m22: Float, var m23: Float, var m30: Float, var m31: Float, var m32: Float, var m33: Float)

A 4x4 matrix class for representing transformations in 3D space.
open class Pose(var t: Vector3 = Vector3(0f, 0f, 0f), var q: Quaternion = Quaternion(1.0f, 0f, 0f, 0f))

Represents a pose in 3D space, which includes a position and an orientation.
class PoseAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: Pose) : TypedAbstractAttribute<Pose>

An attribute that stores a Pose value.
data class PoseAttributeData(val id: Int)

Data Class that holds the unique attribute id for a PoseAttribute
class PoseSortCriterion(val attrId: Int) : SortCriterion

Represents a sorting criterion based on a Pose attribute.
enum PriorityGroup : Enum<PriorityGroup>

This enum represents the priority group a system belongs to. Systems will run in order of their priority groups, then within each group they will be sorted by their dependencies. Nothing runs between each priority group. mustRunBefore of a system must be run in either the same priority group or an earlier one mustRunAfter of a system must be run in either the same priority group or a later one
typealias PriorityGroupMap = MutableMap<SystemClass, PriorityGroup>

Maps system classes to their assigned priority groups. Used to determine the execution order of systems across different priority tiers.
open class Quaternion(var w: Float = 1.0f, var x: Float = 0.0f, var y: Float = 0.0f, var z: Float = 0.0f)

Quaternion class for representing 3D rotations.
class Query

A query system for finding and filtering entities in the Spatial SDK.
class QueryBuilder

A class used to build a query tree.
class QueryNode(val type: QueryNodeType, val args: Array<Int>?, val queryBuilder: QueryBuilder)

A class representing a node in a query tree.
enum QueryNodeType : Enum<QueryNodeType>

An enumeration representing the node type of a query.
class SortBuilder

A builder class for constructing sorting criteria and configurations.
class SortCriteriaBuilder

Builder class for creating sort criteria. All sort criteria are created using the "by" function.
abstract class SortCriterion(val attrId: Int, var propCode: Int = 0, var sortOption: Int = 0)

Sort criterion for sorting a list of entities.
enum SortOption : Enum<SortOption>

Sort options for sorting a list of entities.
class SpatialContext(ctx: <Error class: unknown class>, val spatial: SpatialInterface)
interface SpatialFeature

SpatialFeature is an interface that defines the lifecycle events that a reusable feature can use in a Spatial SDK Application. When extending SpatialFeature, you can override the methods to perform actions during the lifecycle events defined in the interface. The methods are called automatically once the SpatialFeature is registered.
open class SpatialInterface

Core interface between the Spatial SDK’s Kotlin layer and the native C++ implementation.
class StringAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: String) : TypedAbstractAttribute<String>

An attribute that stores a String value.
data class StringAttributeData(val id: Int)

Data Class that holds the unique attribute id for a StringAttribute
class StringSortCriterion(val attrId: Int) : SortCriterion

Represents a sorting criterion based on a StringAttribute.
abstract class SystemBase

Base class for all systems in the spatial SDK.
typealias SystemClass = KClass<out SystemBase>

Represents a reference to a Spatial SDK System class which extends SystemBase.
typealias SystemClassSet = MutableSet<SystemClass>

A collection of unique SystemClass references. Used for tracking groups of systems.
class SystemDAG

Manages the dependency graph of systems in the Spatial SDK.
data class SystemDependencies(val mustRunBefore: MutableSet<SystemDependencyConfig>? = null, val mustRunAfter: MutableSet<SystemDependencyConfig>? = null)

Represents a collection of system dependencies.
data class SystemDependencyConfig(val clazz: KClass<out SystemBase>, val isRequired: Boolean = true)

Represents a configuration for a system dependency.
class SystemManager

Manages the lifecycle and execution of systems within the Spatial SDK.
typealias SystemMap = MutableMap<SystemClass, SystemBase>

Maps system classes to their corresponding system instances. Used to track all registered systems and retrieve their instances when needed.
typealias SystemSet = MutableSet<SystemDependencyConfig>

A collection of SystemDependencyConfig objects. Represents the set of dependencies for a system, including both required and optional dependencies.
class TimeAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: Long) : TypedAbstractAttribute<Long>

An attribute that stores a Time value as a Long milliseconds.
data class TimeAttributeData(val id: Int)

Data Class that holds the unique attribute id for a TimeAttribute
class TimeSortCriterion(val attrId: Int) : SortCriterion

Represents a sorting criterion based on a Time attribute.
object TraceUtils

TraceUtils are used to perform traces on code and do performance optimization. You can utilize Perfetto to analyze the traces.
abstract class TypedAbstractAttribute<T>(keyString: String, key: Int, component: ComponentBase) : AbstractAttribute

Base class for typed attributes that provides common functionality.
class URIAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: <Error class: unknown class>) : TypedAbstractAttribute<<Error class: unknown class>>

An attribute that stores a URI value.
data class URIAttributeData(val id: Int)

Data Class that holds the unique attribute id for a URIAttribute
class UUIDAttribute(keyString: String, key: Int, component: ComponentBase, initialValue: UUID) : TypedAbstractAttribute<UUID>

An attribute that stores a UUID value.
data class UUIDAttributeData(val id: Int)

Data Class that holds the unique attribute id for a UUIDAttribute
open class Vector2(var x: Float = 0.0f, var y: Float = 0.0f)

Represents a 2D vector with x and y components.
class Vector2Attribute(keyString: String, key: Int, component: ComponentBase, initialValue: Vector2) : TypedAbstractAttribute<Vector2>

An attribute that stores a Vector2 value.
data class Vector2AttributeData(val id: Int)

Data Class that holds the unique attribute id for a Vector2Attribute
class Vector2SortCriterion(val attrId: Int) : SortCriterion

Represents a sorting criterion based on a Vector2 attribute.
open class Vector3(var x: Float, var y: Float, var z: Float)

A 3D vector class.
class Vector3Attribute(keyString: String, key: Int, component: ComponentBase, initialValue: Vector3) : TypedAbstractAttribute<Vector3>

An attribute that stores a Vector3 value.
data class Vector3AttributeData(val id: Int)

Data Class that holds the unique attribute id for a Vector3Attribute
class Vector3SortCriterion(val attrId: Int) : SortCriterion

Represents a sorting criterion based on a Vector3 attribute.
open class Vector4(var x: Float, var y: Float, var z: Float, var w: Float)

A 4D vector class with x, y, z, and w components.
class Vector4Attribute(keyString: String, key: Int, component: ComponentBase, initialValue: Vector4) : TypedAbstractAttribute<Vector4>

An attribute that stores a Vector4 value.
data class Vector4AttributeData(val id: Int)

Data Class that holds the unique attribute id for a Vector4Attribute
class Vector4SortCriterion(val attrId: Int) : SortCriterion

Represents a sorting criterion based on a Vector4 attribute.

Properties

NameSummary
CB_EnableCaching
var CB_EnableCaching: <Error class: unknown class>

Global flag to enable or disable component caching.
CP_Stats_ComponentBorrowFailedDirty
var CP_Stats_ComponentBorrowFailedDirty: <Error class: unknown class>
CP_Stats_ComponentBorrowFailedNotCachable
var CP_Stats_ComponentBorrowFailedNotCachable: <Error class: unknown class>
CP_Stats_ComponentBorrowFailedRecycled
var CP_Stats_ComponentBorrowFailedRecycled: <Error class: unknown class>
CP_Stats_ComponentBorrows
var CP_Stats_ComponentBorrows: <Error class: unknown class>
CP_Stats_ComponentCreates
var CP_Stats_ComponentCreates: <Error class: unknown class>
DM_Stats_ComponentCacheChecks
var DM_Stats_ComponentCacheChecks: <Error class: unknown class>
DM_Stats_ComponentCacheSuccess
var DM_Stats_ComponentCacheSuccess: <Error class: unknown class>
DM_Stats_ComponentGets
var DM_Stats_ComponentGets: <Error class: unknown class>
Did you find this page helpful?
Thumbs up icon
Thumbs down icon