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

com.meta.spatial.toolkit

Package-level declarations

Types

NameSummary
class Animated(startTime: Long = -1L, pausedTime: Float = 0.0f, playbackState: PlaybackState = PlaybackState.PLAYING, playbackType: PlaybackType = PlaybackType.LOOP, track: Int = 0) : ComponentBase

The animated component is used to play animations for a glTF asset. It also configures different settings for animation playback. It allows the selection of different playback types, states, and different animation tracks if applicable.
open class AppSystemActivity : VrActivity, AppSystemCommon

AppSystemActivity serves as the base class for all Spatial activities. It contains all Android activity lifecycle callbacks: onCreate, onStop, onDestroy and others. It also provides scene lifecycle callbacks: onSceneReady and onSceneTick. This class also provides hooks to override system features through registerSystemFeatures and to register panels through registerPanels.
interface AppSystemCommon

This interface is used to provide a common interface for both AppSystemActivities and AppSystemServices. It provides access to the SystemManager and allows for registering mesh creators.
open class AppSystemService : VrService, AppSystemCommon, SpatialViewModelOwner

AppSystemService serves as the base class for all Spatial SDK services. It contains all Android service lifecycle callbacks: onCreate, onDestroy, and others. It also provides scene lifecycle callbacks: onSceneReady and onSceneTick. This class also provides hooks to override system features through registerSystemFeatures and to register panels through registerPanels.
class Audio(audio: String = "", volume: Float = 1.0f) : ComponentBase

Audio component that can be attached to an entity. This component will play audio spatially from the entity.
class AudioSystem : SystemBase

This System is responsible for playing audio and managing audio assets.
class AvatarAttachment(type: String = "") : ComponentBase

Defines what part of an Avatar the entity is meant to represent. (head, body, controller, etc.)
class AvatarBody(head: Entity = Entity.nullEntity(), leftHand: Entity = Entity.nullEntity(), rightHand: Entity = Entity.nullEntity(), root: Entity = Entity.nullEntity(), isPlayerControlled: Boolean = false) : ComponentBase

AvatarBody is a component that represents the body of an avatar. It contains references to the head, left hand, right hand, and root of the avatar. It also contains a boolean flag to indicate whether the avatar is player controlled.
class AvatarSystem : SystemBase

This System handles the visibility of the controllers and hands.
enum BodyJoint : Enum<BodyJoint>

Describes each joint found in TrackedBody
class Box(min: Vector3 = Vector3(0.0f, 0.0f, 0.0f), max: Vector3 = Vector3(0.0f, 0.0f, 0.0f)) : ComponentBase

Defines the dimensions of a box shape by the relative offset of two opposite corners. This is to be used with the mesh://box URI on Mesh component. Material can be customized with the Material component.
class Color3
class Color4
class Controller(buttonState: Int = 0, changedButtons: Int = 0, isActive: Boolean = false, type: ControllerType = ControllerType.CONTROLLER, directTouchEnabled: Boolean = false, directTouchButtonState: Int = 0, laserEnabled: Boolean = true) : ComponentBase

Represents Controller Data and properties that can be used to facilitate input.
enum ControllerType : Enum<ControllerType>

This represents what type of controller a Controller component represents.
class CreatorVisibility(state: CreatorVisibilityState = CreatorVisibilityState.CREATOR_ONLY_VISIBLE) : ComponentBase

Use this Component to hide an Entity from every user except for the creator of the Entity or hide the entity from only the creator. This MUST be used with dynamically created Entities, Entities created using scene.xml do not have a "creator" and so will not be hidden.
enum CreatorVisibilityState : Enum<CreatorVisibilityState>

CreatorVisibilityState is an enum that represents the state of the CreatorVisibility Component.
class DeleteEntitiesSystem : SystemBase

This System comes default with Meta Spatial SDK and operates on entities that have been marked for deletion in the com.meta.spatial.core.DataModel. It interacts with SceneObjectSystem to clean up associated com.meta.spatial.runtime.SceneObjects.
class Dome(radius: Float = 950.0f) : ComponentBase

Defines the dimensions of a dome shape by a radius. This is to be used with the mesh://dome URI on Mesh component. Material can be customized with the Material component.
sealed class FlatColorMaterials

Preset Material Components based on W3C Web colors for use with procedural meshes created by the Mesh Component.
class Followable(target: Entity = Entity.nullEntity(), offset: Pose = Pose(Vector3(0.0f, 0.0f, 3.0f), Quaternion(0.0f, 0.0f, 1.0f, 0.0f)), minAngle: Float = -90f, maxAngle: Float = 90.0f, type: FollowableType = FollowableType.FACE, tolerance: Float = 0.2f, speed: Float = 1.0f, active: Boolean = true) : ComponentBase

Followable is a component that enables an entity to stay in front of another entity. Followable will track the orientation of the parent and move itself to stay in front.
class FollowableSystem : SystemBase

This system comes default with Meta Spatial SDK and operates on entities with Followable and Transform components. It allows objects to automatically follow and orient themselves toward target entities, with configurable offset, rotation type, and speed parameters.
enum FollowableType : Enum<FollowableType>

What type of behavior an object has when following (faces user, pivots on y axis, etc.)
class GLXF(uri: <Error class: unknown class> = Uri.EMPTY) : ComponentBase

This Component is used to represent a GLXF file from a URI. The URI can be a local file or a remote file.
class GLXFEntityDeletionSystem(val glXFManager: GLXFManager) : SystemBase

This System comes default with Meta Spatial SDK and operates on entities that are part of GLXF models. It interacts with GLXFManager and DeleteEntitiesSystem to properly clean up GLXF entities and their children.
class GLXFInfo(val glxfManager: GLXFManager, val version: String, val experience: Boolean, assets: MutableList<GLXFAsset>, var nodes: MutableList<GLXFNode>, val rootEntity: Entity, val uri: <Error class: unknown class>, context: <Error class: unknown class>, nodeMap: NodeMap = mutableMapOf<Entity, GLXFNode>(), nodesByName: MutableMap<String, GLXFNode> = mutableMapOf<String, GLXFNode>(), val keyName: String? = null, entityIdToEntityMap: MutableMap<String, Entity>, overrideCreateEntity: (<Error class: unknown class>?) -> Entity)

GLXFInfo is a class that represents a GLXF file. Refer to https://github.com/KhronosGroup/glTF-External-Reference/blob/main/specification/2.0/README.md for detailed specification.
class GLXFInternalNode(val entity: Entity, transform: GLXFNodeTransform, var name: String? = null, asset: GLXFAsset = GLXFAsset.nullGLXFAsset(), children: MutableList<GLXFNode> = mutableListOf<GLXFNode>(), childrenIndices: MutableSet<Int> = mutableSetOf<Int>(), isRoot: Boolean = true) : GLXFNode

A subclass of GLXFNode that represents a node in a GLXF file that has children.
class GLXFLeafNode(val entity: Entity, transform: GLXFNodeTransform, var name: String? = null, asset: GLXFAsset) : GLXFNode

A subclass of GLXFNode that represents a leaf node in a GLXF file.
class GLXFManager(val context: <Error class: unknown class>)

GLXFManager is a class that manages the inflation of glXF files into Spatial SDK entities. It manages the full lifecycle of glXFs that are inflated, including deletion.
open class GLXFNode(val entity: Entity, transform: GLXFNodeTransform, var name: String? = null, asset: GLXFAsset = GLXFAsset.nullGLXFAsset())

An open class representing a node in a GLXF file. You can use it to access the entity that has been inflated to represent the node.
enum GLXFReloadType : Enum<GLXFReloadType>

GLXFReloadType is an enum that specifies how GLXFs should be reloaded.
class GLXFRoot(rootEntity: Entity = Entity.nullEntity()) : ComponentBase

GLXFRoot is a Component that is applied to all entities that are inflated as part of glXF EXCEPT for the root entity. The GLXFRoot component will point to the rootEntity of the glXF that this entity was inflated with. This is used internally to handle cleanup of glXFs when entities are deleted. It is not advised to manipulate or set this component on entities.
class Grabbable(enabled: Boolean = true, type: GrabbableType = GrabbableType.FACE, isGrabbed: Boolean = false, minHeight: Float = -Float.MAX_VALUE, maxHeight: Float = Float.MAX_VALUE) : ComponentBase

Grabbable is a component that allows an object to be grabbed by a controller. It requires the Entity to have a com.meta.spatial.runtime.SceneObject attached.
class GrabbableSystem : SystemBase

GrabbableSystem is a System that allows for grabbing of objects in the scene. It is responsible for detecting when an object is grabbed and then updating the object’s position and rotation to match the grabber’s position and rotation. It also handles the release of the object when the grabber releases it.
enum GrabbableType : Enum<GrabbableType>

GrabbableType is an enum that defines the type of behavior an object has when grabbed.
class Hittable(hittable: MeshCollision = MeshCollision.LineTest) : ComponentBase

Defines whether an Entity is hittable. If an Entity is hittable then raycasts from controllers/hands will intersect with the com.meta.spatial.runtime.SceneObject and trigger com.meta.spatial.runtime.InputListeners. If Entity is using the Mesh or Panel components the Mesh.hittable or Panel.hittable attribute should be used instead. This component is used for the advanced case when a com.meta.spatial.runtime.SceneObject is manually assigned to an Entity.
class Material(repeatU: Float = 1.0f, repeatV: Float = 1.0f, offsetU: Float = 0.0f, offsetV: Float = 0.0f, baseColor: Color4 = Color4(0.5f, 0.5f, 0.5f, 1.0f), metallicInternal: Float = 0.0f, roughnessInternal: Float = 0.3f, unlit: Boolean = false, alphaMode: Int = com.meta.spatial.runtime.AlphaMode.OPAQUE.ordinal, shader: String = "", baseTextureAndroidResourceId: Int = 0) : ComponentBase

Material is a component that describes the material properties of an object. This component is only used to assign properties to procedural meshes such as those created with the Mesh component. Meta Spatial SDK provides some basic preset materials with FlatColorMaterials.
class Mesh(mesh: <Error class: unknown class> = Uri.EMPTY, hittable: MeshCollision = MeshCollision.LineTest, defaultShaderOverride: String = "", defaultSceneOverride: Int = 0) : ComponentBase

Mesh component, used to specify a mesh to be rendered. This component is used to specify the mesh uri, hittable, default shader override, and default scene override.
enum MeshCollision : Enum<MeshCollision>

Mesh collision test type, used to determine how a mesh is hit tested. This is used in the Mesh, Panel, and Hittable components.
class MeshCreationSystem(val meshManager: MeshManager) : SystemBase

MeshCreationSystem is responsible for creating the mesh for an entity when the Mesh component is added.
class MeshManager(val scene: Scene, val meshCreators: HashMap<String, (ent: Entity) -> SceneMesh>, val sceneObjectSystem: SceneObjectSystem)

Manages 3D meshes for entities in the Aether framework.
class Named(name: String = "n/a") : ComponentBase

A named component. This is a simple component that can be used to name the Entity. This is useful for debugging as the com.meta.spatial.datamodelinspector.DataModelInspectorFeature will display this.
class Panel(panelRegistrationId: Int = 0, hittable: MeshCollision = MeshCollision.LineTest) : ComponentBase

The Panel component is used to spawn a panel attached to the associated entity. The PanelCreationSystem is responsible for creating and deleting the associated PanelSceneObjects for the entity. The panelRegistrationId attribute is used to find the associated PanelRegistration when creating a panel. See our Panel spawning docs for more information.
class PanelCreationSystem(val panelCreator: HashMap<Int, (ent: Entity) -> PanelSceneObject>) : SystemBase

PanelCreationSystem is responsible for creating PanelSceneObjects for Entities with the Panel component. The PanelCreationSystem takes the registrations from AppSystemActivity.registerPanels(), uses the PanelConfigOptions to create PanelSceneObjects, and then links them with the Entity.
class PanelCreator(val registrationId: Int, panelCreator: (entity: Entity) -> PanelSceneObject) : PanelRegistration

PanelCreator is a class that allows you to specify the panel creator function for a panel. The panel creator function is any customized function that takes an entity as input and returns the @see PanelSceneObject.
class PanelDimensions(dimensions: Vector2 = Vector2(0.75f, 1.0f)) : ComponentBase

PanelDimensions is a component that holds the dimensions of a panel. This is used to override the height and width of a panel when creating the panel. Without it, the panel’s height and width will be the values from @see PanelRegistration.
class PanelDimensionsSystem : SystemBase

PanelDimensionsSystem is responsible for updating the PanelDimensionsOverrides for each panel. The PanelDimensionsOverrides are used to determine the size of the panel.
open class PanelRegistration(val registrationId: Int, val init: PanelRegistration.(entity: Entity) -> Unit = {})

PanelRegistration is a class that allows you to register a panel with the Spatial Toolkit. To use panels in your app, you will need to:
object PerfLogger

Utility for measuring and tracking execution times of operations in the code.
class Plane(width: Float = 1.0f, depth: Float = 1.0f) : ComponentBase

Defines the dimensions of a horizontal plane. This is to be used with the mesh://plane URI on Mesh component. Material can be customized with the Material component.
enum PlaybackState : Enum<PlaybackState>

Playback state of the animation. This is used to determine whether the animation is playing or paused.
enum PlaybackType : Enum<PlaybackType>

Playback type of the animation. This is used to determine how the animation is played.
class PlayerBodyAttachmentSystem : SystemBase

This PlayerBodyAttachmentSystem is responsible for setting the local player’s avatar body components based on the local player’s attachments.
class ProcessListenersSystem(val spatial: SpatialInterface) : SystemBase

This System comes default with Meta Spatial SDK and processes listeners in the com.meta.spatial.core.DataModel.
class Quad(min: Vector2 = Vector2(0.0f, 0.0f), max: Vector2 = Vector2(1.0f, 1.0f)) : ComponentBase

Defines a single-sided 2D rectangular shape in 3D space by specifying minimum and maximum coordinates. This is to be used with the mesh://quad URI on Mesh component. Material can be customized with the Material component.
class ResetDataModelSystem(val spatial: SpatialInterface) : SystemBase

This System comes default with Meta Spatial SDK and is "resets" the com.meta.spatial.core.DataModel every tick. The Data Model reset is responsible for collecting changes and making them accessible via the "changed" com.meta.spatial.core.Query.
class RoundedBox(min: Vector3 = Vector3(0.0f, 0.0f, 0.0f), max: Vector3 = Vector3(1.0f, 1.0f, 1.0f), radius: Vector3 = Vector3(0.1f, 0.1f, 0.1f)) : ComponentBase

Defines the dimensions of a box shape with rounded edges by specifying the relative offset of two opposite corners and a Vector3 of radii to modify the roundedness of the edges. This is to be used with the mesh://roundedbox URI on Mesh component. Material can be customized with the Material component.
class Scale(scale: Vector3 = Vector3(1.0f, 1.0f, 1.0f)) : ComponentBase

Sets the scale for any com.meta.spatial.core.Entity with a com.meta.spatial.runtime.SceneObject attached. com.meta.spatial.runtime.SceneObjects can be attached with the Mesh and Panel components.
class ScaleSystem : SystemBase

This System scales an entity based on the Scale component.
class SceneObjectSystem : SystemBase

System to manage SceneObjects. This acts as a registry for other systems to get the SceneObject associated with an entity.
class SceneUpdateTickTimeSystem(val spatial: SpatialInterface) : SystemBase

This System comes default with Meta Spatial SDK and is responsible for updating the scene’s internal time tracking.
object SpatialActivityManager

This object is used to manage the current activity. It is used to get a weak reference to the current activity and execute code on the current activity.
class Sphere(radius: Float = 0.5f) : ComponentBase

Defines the dimensions of a sphere by specifying its radius. This is to be used with the mesh://sphere URI on Mesh component. Material can be customized with the Material component.
class SupportsLocomotion : ComponentBase

This component is used to indicate that an entity supports locomotion. When added to an entity with a Mesh, it allows for default locomotion on the mesh.
class TickAnimationSystem(val spatial: SpatialInterface) : SystemBase

This System comes default with Meta Spatial SDK and updates animations running on com.meta.spatial.runtime.SceneObjects.
class TickControllerSystem(val spatial: SpatialInterface) : SystemBase

This System comes default with Meta Spatial SDK and handles the behavior of controllers.
class TickDataModelSystem(val spatial: SpatialInterface) : SystemBase

This System comes default with Meta Spatial SDK and processes the changes that happen in the com.meta.spatial.core.DataModel.
class TickTransformSystem(val spatial: SpatialInterface) : SystemBase

This System comes default with Meta Spatial SDK and is responsible for calculating and setting the transforms of the entities. It operates on entities with Transform components and ensures they are placed properly in the scene. It is also responsible for properly positioning Entities relative to their TransformParent.
class ToolkitFeature(val glXFManager: GLXFManager, spatial: SpatialInterface, systemManager: SystemManager, ctx: <Error class: unknown class>) : SpatialFeature

ToolkitFeature is a com.meta.spatial.core.SpatialFeature that provides core toolkit functionality for Spatial SDK applications. This feature is registered by default in AppSystemActivity, so you do not need to manually register it in your registerFeatures() method
class Transform(transform: Pose = Pose()) : ComponentBase

A component that represents a transform, which is the position and orientation of an entity. The transform is represented by a com.meta.spatial.core.Pose, which is a combination of a position (com.meta.spatial.core.Vector3) and an orientation (com.meta.spatial.core.Quaternion).
class TransformBuilder

A builder class for creating and chaining spatial transformations that result in a final Pose
class TransformParent(entity: Entity = Entity.nullEntity()) : ComponentBase

This component can be used to set up a transform hierarchy for your entities. When set, the transform on your entity will be relative to their TransformParent. As the TransformParent entity moves, this entity will move as well.
class Visible(isVisible: Boolean = true) : ComponentBase

Gives the ability to show/hide the mesh on an entity.
class VisibleSystem : SystemBase

This System uses the Visible component to show/hide entity meshes.

Properties

NameSummary
changed
const val changed: Int = 1
distance
const val distance: Float = 0.0f
downTime
const val downTime: Long = 1000
meshElementId
const val meshElementId: Int = 0
nodeId
const val nodeId: Int = 0
point
val point: Vector3
srcId
const val srcId: Long = 2000
SUPPORTED_GLXF_EXTENSIONS
val SUPPORTED_GLXF_EXTENSIONS: Set<String>

A set of supported GLXF file extensions.
textureCoordinate
val textureCoordinate: Vector2

Functions

NameSummary
addName
fun Entity.addName(name: String): Entity
Box
fun Box(size: Vector3): Box

Creates a box with a given size in each dimension.



fun Box(edgeLength: Float = 1.0f): Box

Creates a cube with a given edge length.
clampYAngle
fun clampYAngle(vector: Vector3, minAngleDegrees: Float, maxAngleDegrees: Float): Vector3

Clamp the Y angle of a vector to a given range. This function ensures that the Y angle of the vector is within the specified range, while maintaining the length and XZ components
createPanelEntity
fun Entity.Companion.createPanelEntity(panelId: Int, transform: Transform, vararg components: ComponentBase): Entity

fun Entity.Companion.createPanelEntity(entityId: Int, panelId: Int, transform: Transform, vararg components: ComponentBase): Entity
fromBox
fun Entity.Companion.fromBox(length: Float, transform: Transform, material: Material? = null, vararg components: ComponentBase): Entity
fromGLB
fun Entity.Companion.fromGLB(mesh: Mesh, transform: Transform, vararg components: ComponentBase): Entity
fromMeshAndMaterial
fun Entity.Companion.fromMeshAndMaterial(mesh: Mesh, material: Material, transform: Transform, vararg components: ComponentBase): Entity
fromPanelRegistry
fun Entity.Companion.fromPanelRegistry(registry: PanelRegistration, transform: Transform, vararg components: ComponentBase): Entity
fromSphere
fun Entity.Companion.fromSphere(length: Float, transform: Transform, material: Material? = null, vararg components: ComponentBase): Entity
getAbsoluteTransform
fun getAbsoluteTransform(entity: Entity): Pose
getRelativePose
fun getRelativePose(parent: Entity, child: Entity): Pose

fun getRelativePose(parent: Entity, child: Pose): Pose

fun getRelativePose(parent: Pose, child: Pose): Pose
MeshMaterialOverrides
fun MeshMaterialOverrides(colors: <Error class: unknown class><Int, Int>): MeshMaterialOverrides

Creates a MeshMaterialOverrides component with a given map of Ints representing materials to Ints representing colors. This is a secondary constructor for the MeshMaterialOverrides component
PanelClickState
fun PanelClickState(clickState: ClickState): PanelClickState

Createst a PanelClickState component with a given ClickState. This is a secondary constructor for the PanelClickState component
reparentChildInWorldCoordinates
fun reparentChildInWorldCoordinates(parent: Entity, child: Entity)
resetFollowable
fun resetFollowable(followable: Entity)

This resets the offset of the Followable component of the entity to the current offset from its target.
Scale
fun Scale(scaleValue: Float): Scale
TrackedBody
fun TrackedBody(jointPoses: <Error class: unknown class><Int, Pose>): TrackedBody

Creates a TrackedBody component with a given map of Ints representing joints to Poses. This is a secondary constructor for the TrackedBody component
Did you find this page helpful?
Thumbs up icon
Thumbs down icon