open class SpatialInterface
SpatialInterface
()
|
Signature
constructor() Returns SpatialInterface |
appPtr_
: Long
[Get] |
Pointer to the native application instance. This is set during initialization and used for all native method calls.
Signature
var appPtr_: Long |
dataModel
: DataModel
[Get] |
The data model associated with this spatial interface. Contains the entity-component data for the application.
Signature
lateinit var dataModel: DataModel |
applyHapticFeedback
(
hand
, amplitude
, duration
, frequency
)
|
Applies the given haptic feedback to both controllers.
This method triggers haptic feedback (vibration) on the specified controller, allowing for tactile feedback in response to user interactions.
Signature
fun applyHapticFeedback(hand: Hand, amplitude: Float, duration: Long, frequency: Float) Parameters amplitude: Float
Value between 0 - 1 for strength of haptics.
duration: Long
Time in nanoseconds for how long the haptic feedback should be applied.
frequency: Float
Frequency of vibration (in hz).
|
createPhysicsObject
(
entity
, shape
)
|
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 Physics component to a Mesh entity.
This method adds physics simulation capabilities to an entity, allowing it to participate in the physics world with collisions and dynamics.
Signature
fun createPhysicsObject(entity: Entity, shape: String) Parameters shape: String
The shape of the physics object (e.g., "box", "sphere", "capsule"), or the path to the glb file.
|
enableAABBDebugLines
(
enabled
)
|
Toggles debug lines for AABB(Axis Aligned Bounding Boxes) around each scene object.
This is useful for visualizing the spatial extents of objects in the scene and understanding collision boundaries.
Signature
fun enableAABBDebugLines(enabled: Boolean) Parameters enabled: Boolean
Whether to enable or disable AABB debug lines.
|
enableInput
(
enabled
)
|
Controls whether input (controllers and hands) are enabled. This method can be used to temporarily disable input processing.
Signature
fun enableInput(enabled: Boolean) Parameters enabled: Boolean
Whether input should be enabled or disabled.
|
enablePhysicsDebugLines
(
enabled
)
|
Toggles debug lines for visualization of the physics simulation. The color of the lines correspond to the state of the physics objects.
This is useful for debugging physics interactions and understanding how physics bodies are behaving in the scene.
Signature
fun enablePhysicsDebugLines(enabled: Boolean) Parameters enabled: Boolean
Whether to enable or disable physics debug lines.
|
setGravity
(
x
, y
, z
)
|
Sets the gravity vector for the physics simulation.
This method allows customizing the direction and strength of gravity in the physics world, which affects how objects fall and interact.
Signature
fun setGravity(x: Float, y: Float, z: Float) Parameters x: Float
The x-component of the gravity vector.
y: Float
The y-component of the gravity vector.
z: Float
The z-component of the gravity vector.
|
setPerformanceLevel
(
level
)
|
Set the performance level for both CPU and GPU.
This allows developers to control the performance level of the device. Higher performance levels provide better performance but consume more power.
Example usage:
// Set to boost mode during intensive operations spatial.setPerformanceLevel(PerformanceLevel.BOOST_HINT) // Disable boost by setting back to default (SUSTAIN_HIGH) spatial.setPerformanceLevel(PerformanceLevel.SUSTAIN_HIGH) // Set to sustained low mode to preserve battery life spatial.setPerformanceLevel(PerformanceLevel.SUSTAINED_LOW)
Signature
fun setPerformanceLevel(level: PerformanceLevel): Boolean Parameters Returns Boolean
true if the operation was successful, false otherwise.
|