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

MRUKFeature

MRUKFeature

class MRUKFeature(val context: <Error class: unknown class>, val systemManager: SystemManager) : SpatialFeature
MRUK - Mixed Reality Utility Kit
MRUK offers enhanced scene-related functionality utilizing OpenXR scene APIs. It facilitates loading rooms along with their scene anchors. Additionally, MRUK supports loading scenes from JSON files (as demonstrated in the MRUK sample), enabling testing of various room configurations. Take a look at MrukSampleActivity to see how it can be used. The MRUKFeature serves as the primary entry point for MRUK, handling the loading of scene data from the device. If loadSceneFromDevice or loadSceneFromJsonString are called multiple times MRUK will add, update, and remove rooms to keep the rooms in MRUKFeature in sync with the rooms that are in the system. MRUKFeature provides callbacks that can be used to get notified when rooms or anchors get added, updated, or removed.

Constructors

NameSummary
MRUKFeature
constructor(context: <Error class: unknown class>, systemManager: SystemManager)

Types

NameSummary
Companion
object Companion

Properties

NameSummary
context
val context: <Error class: unknown class>
rooms
val rooms: MutableList<MRUKRoom>
systemManager
val systemManager: SystemManager

Functions

NameSummary
addSceneEventListener
fun addSceneEventListener(listener: MRUKSceneEventListener)
clearRooms
fun clearRooms()
componentsToRegister
open override fun componentsToRegister(): List<ComponentRegistration>

Override this function to define a list of components that should be used by the application.
configureTrackers
fun configureTrackers(trackers: Set<Tracker>): CompletableFuture<MRUKStartTrackerResult>
earlySystemsToRegister
open fun earlySystemsToRegister(): List<SystemBase>

Override this method to register your systems that should be executed with com.meta.spatial.core.PriorityGroup EARLY.
findRoom
fun findRoom(roomUuid: UUID): MRUKRoom?

Find a room that matches the given roomUuid
getCurrentRoom
fun getCurrentRoom(): MRUKRoom?
getDependencies
open fun getDependencies(): List<KClass<out SpatialFeature>>

Override this method to define a list of dependencies required by this feature. This will be verified at runtime.
lateSystemsToRegister
open fun lateSystemsToRegister(): List<SystemBase>

Override this method to register your systems that should be executed with com.meta.spatial.core.PriorityGroup LATE.
loadLibrary
open fun loadLibrary(libName: String)

Loads a native library into the application.
loadSceneFromDevice
fun loadSceneFromDevice(requestSceneCaptureIfNoDataFound: Boolean = true, removeMissingRooms: Boolean = true): CompletableFuture<MRUKLoadDeviceResult>

Load the scene from the device.
loadSceneFromJsonString
fun loadSceneFromJsonString(jsonString: String, removeMissingRooms: Boolean = true)

Load the scene from a JSON string.
onCreate
open override fun onCreate(savedInstanceState: <Error class: unknown class>?)

Called when the application is created. Override this method to perform actions during the OnCreate() lifecycle of the application.
onDestroy
open fun onDestroy()

Called when the application is in onDestroy callback. Be aware that onDestroy() is not guaranteed to be called. Override this method to perform actions during the OnDestroy() lifecycle of the application.
onPauseActivity
open fun onPauseActivity()

Called when the activity is in onPause callback. Override this method to perform actions during the OnPause() lifecycle of the application.
onResume
open fun onResume()

Called when the application is resumed. Override this method to perform actions during the OnResume() lifecycle of the application.
onSceneReady
open fun onSceneReady()

Called when the scene is ready. Override this method to perform actions during the OnSceneReady() lifecycle of the application.
onSpatialShutdown
open override fun onSpatialShutdown()

Called when the application is shutting down. Clean up all Spatial resources for your feature, e.g. entites.destroy(), in this callback.
onStart
open fun onStart()

Called when the application is started. Override this method to perform actions during the OnStart() lifecycle of the application.
onStopActivity
open fun onStopActivity()

Called when the activity is in onStop callback. Be aware that onStop() is not guaranteed to be called. Override this method to perform actions during the OnStop() lifecycle of the application.
onVRPause
open fun onVRPause()

Called when the VR mode is paused. Override this method to perform actions during the OnVRPause() lifecycle of the application.
onVRReady
open fun onVRReady()

Called when the VR mode is ready. Override this method to perform actions during the onVRReady() lifecycle of the application.
preRuntimeOnCreate
open fun preRuntimeOnCreate(savedInstanceState: <Error class: unknown class>?)

Called before the application’s onCreate() method is called. Override this method to perform actions before the rest of the OnCreate() lifecycle of the application.
raycastRoom
fun raycastRoom(roomUuid: UUID, origin: Vector3, direction: Vector3, maxDistance: Float = Float.POSITIVE_INFINITY, surfaceType: SurfaceType = SurfaceType.ALL): MRUKHit?
raycastRoomAll
fun raycastRoomAll(roomUuid: UUID, origin: Vector3, direction: Vector3, maxDistance: Float = Float.POSITIVE_INFINITY, surfaceType: SurfaceType = SurfaceType.ALL): Array<MRUKHit>
registerRequiredOpenXRExtensions
open override fun registerRequiredOpenXRExtensions(): List<String>

Override this function to define a list of required OpenXR extensions that should be enabled by your application.
removeSceneEventListener
fun removeSceneEventListener(listener: MRUKSceneEventListener)
requestSceneCapture
fun requestSceneCapture(): CompletableFuture<Unit>

Brings up the system dialog that prompts the user to setup a space. This can be called automatically by loadSceneFromDevice() in case no room data is setup.
saveSceneToJsonString
fun saveSceneToJsonString(): String
stopTrackers
fun stopTrackers()
systemsToRegister
open override fun systemsToRegister(): List<SystemBase>

Override this method to register your systems that should be executed com.meta.spatial.core.PriorityGroup NORMAL.

Companion

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