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

SpatialInterface

SpatialInterface

open class SpatialInterface
Core interface between the Spatial SDK’s Kotlin layer and the native C++ implementation.
SpatialInterface provides access to the underlying native functionality through JNI. It handles initialization, destruction, and the execution of various subsystems including:
  • Physics simulation
  • Animation
  • Input (controllers and hands)
  • Transformation systems
  • Data model synchronization
This class is typically instantiated and managed by VrActivity or its subclasses, which handle the proper sequencing of method calls throughout the application lifecycle.

Constructors

NameSummary
SpatialInterface
constructor()

Types

NameSummary
Companion
object Companion

Properties

NameSummary
appPtr_
var appPtr_: Long

Pointer to the native application instance. This is set during initialization and used for all native method calls.
dataModel
lateinit var dataModel: DataModel

The data model associated with this spatial interface. Contains the entity-component data for the application.

Functions

NameSummary
applyHapticFeedback
fun applyHapticFeedback(hand: Hand, amplitude: Float, duration: Long, frequency: Float)

Applies the given haptic feedback to both controllers.
createPhysicsObject
fun createPhysicsObject(entity: Entity, shape: String)

Creates a physics object for the specified entity with the given shape. This is an API for internal use only. To create a physics object, set a com.meta.spatial.physics.Physics component to a Mesh entity.
enableAABBDebugLines
fun enableAABBDebugLines(enabled: Boolean)

Toggles debug lines for AABB(Axis Aligned Bounding Boxes) around each scene object.
enableInput
fun enableInput(enabled: Boolean)

Controls whether input (controllers and hands) are enabled. This method can be used to temporarily disable input processing.
enablePhysicsDebugLines
fun enablePhysicsDebugLines(enabled: Boolean)

Toggles debug lines for visualization of the physics simulation. The color of the lines correspond to the state of the physics objects.
setGravity
fun setGravity(x: Float, y: Float, z: Float)

Sets the gravity vector for the physics simulation.
setPerformanceLevel
fun setPerformanceLevel(level: PerformanceLevel): Boolean

Set the performance level for both CPU and GPU.

Companion

object Companion
Did you find this page helpful?
Thumbs up icon
Thumbs down icon