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

UMRUKSubsystem Class

Extends UGameInstanceSubsystem, FTickableGameObject
The Mixed Reality Utility Kit subsystem.
This subsystem acts as a container for scene/anchor data. It has methods to load the scene data from the device or a JSON file. After the scene data has been loaded it will be stored inside the subsystem to make it possible to query the data from everywhere. In addition, it offers methods to fulfill queries on the scene data like ray casts or simple content placement.
The subsystem only contains core functionality that is useful for most cases. More specific functionality is part of actors. For example, if your goal is to spawn meshes in the place of scene anchors you can place the AMRUKAnchorActorSpawner in the level to do this. When a level loads you would first load the anchor data from the device with this subsystem by calling LoadSceneFromDevice() and then the AMRUKAnchorActorSpawner will listen for the subsystem to load the scene data and then spawn the actors accordingly.
You can expect methods in this subsystem to take all loaded rooms into consideration when computing. If you want to use a method only on a single specific room, there is most of the time a method with the same name on the AMRUKRoom.

Fields

The status of the scene loading. When loading from device this is an asynchronous process so will be in the Busy state until it moves to Complete or Failed.
An event that will trigger when a scene is loaded either from Device or from JSON. The Success parameter indicates whether the scene was loaded successfully or not.
An event that gets fired after a room has been created.
An event that gets fired after a room has been updated.
An event that gets fired when a room gets removed.
An event that will trigger when the capture flow completed. The Success parameter indicates whether the scene was captured successfully or not.
Contains a list of rooms that are tracked by the mixed reality utility kit subsystem.
When world locking is enabled the position of the VR Pawn will be adjusted each frame to ensure the room anchors are where they should be relative to the camera position. This is necessary to ensure the position of the virtual objects in the world do not get out of sync with the real world.

Member Functions

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam
( FOnLoaded ,
bool ,
Success )
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam
( FOnCaptureComplete ,
bool ,
Success )
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam
( FOnRoomCreated ,
Room )
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam
( FOnRoomUpdated ,
Room )
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam
( FOnRoomRemoved ,
Room )
Cast a ray and return the closest hit anchor in the scene.
Parameters
Origin
Origin The origin of the ray.
Direction
Direction The direction of the ray.
MaxDist
The maximum distance the ray should travel.
LabelFilter
The label filter can be used to include/exclude certain labels from the search.
OutHit
The closest hit.
Returns
The anchor that the ray hit
Cast a ray and collect hits against the volumes and plane bounds in every room in the scene. The order of the hits in the array is not specified.
Parameters
Origin
Origin The origin of the ray.
Direction
Direction The direction of the ray.
MaxDist
The maximum distance the ray should travel.
LabelFilter
The label filter can be used to include/exclude certain labels from the search.
OutHits
The hits the ray collected.
OutAnchors
The anchors that were hit. Each anchor in this array corresponds to a entry at the same position in OutHits.
Returns
Whether the ray hit anything
Return the room that the headset is currently in. If the headset is not in any given room then it will return the room the headset was last in when this function was called. If the headset hasn't been in a valid room yet then return the first room in the list. If no rooms have been loaded yet then return null.
Save all rooms and anchors to JSON. This JSON representation can than later be used by LoadSceneFromJsonString() to load the scene again.
Returns
the JSON string.
Load rooms and anchors from a JSON representation. If the scene is already loaded the scene will be updated with the changes.
Load rooms and anchors from the device. If the scene is already loaded the scene will be updated with the changes.
Removes and clears every room.
Get the position on the surface that is closest to the given position with respect to the distance in all rooms.
Parameters
WorldPosition
The position in world space from which the closest surface point should be found.
OutSurfacePosition
The closest position on the closest surface if any. Otherwise zero.
LabelFilter
The label filter can be used to include/exclude certain labels from the search.
MaxDistance
The distance to which a closest surface position should be searched. Everything below or equal to zero will be treated as infinity.
Returns
The Anchor on which the closest surface position was found or a null pointer otherwise.
Finds the closest seat given a ray.
Parameters
RayOrigin
The origin of the ray.
RayDirection
The direction of the ray.
OutSeatTransform
The seat pose.
Returns
If any seat was found the Anchor that has seats available will be returned. Otherwise a null pointer.
Get a suggested pose (position & rotation) from a raycast to place objects on surfaces in the scene. There are different positioning modes available. Default just uses the position where the raycast hit the object. Edge snaps the position to the edge that is nearest to the user and Center simply centers the position on top of the surface.
Parameters
RayOrigin
The origin of the ray.
RayDirection
The direction of the ray.
MaxDist
The maximum distance the ray should travel.
LabelFilter
The label filter can be used to include/exclude certain labels from the search.
OutPose
The calculated pose.
PositioningMethod
The method that should be used for determining the position on the surface.
Returns
The anchor that was hit by the ray if any. Otherwise a null pointer.
Return the longest wall in the current room that has no other walls behind it.
Parameters
Tolerance
The tolerance to use when determining wall that are behind.
Returns
The wall anchor that is the key wall in the room.
Return the largest surface for a given label in the current room.
Parameters
Label
The label of the surfaces to search in.
Returns
The anchor that has the largest surface if any. Otherwise, a null pointer.
Checks if the given position is on or inside of any scene volume in the rooms. All rooms will be checked and the first anchors scene volume that has the point on or inside it will be returned.
Parameters
WorldPosition
The position in world space to check
TestVerticalBounds
Whether the vertical bounds should be checked or not
Tolerance
Tolerance
Returns
The anchor the WorldPosition is in. A null pointer otherwise.
Spawn meshes on the position of the anchors of each room. The actors should have Z as up Y as right and X as forward. The pivot point should be in the bottom center.
Parameters
SpawnGroups
A map which tells to spawn which actor to a given label.
ProceduralMaterial
Material to apply on top of the procedural mesh if any.
CutHoleLabels
Labels for which the generated mesh should have holes. Only works with planes.
ShouldFallbackToProcedural
Whether or not it should by default fallback to generating a procedural mesh if no actor class has been specified for a label.
Returns
The spawned actors.
Spawn meshes on the position of the anchors of each room from a random stream. The actors should have Z as up Y as right and X as forward. The pivot point should be in the bottom center.
Parameters
SpawnGroups
A map which tells to spawn which actor to a given label.
RandomStream
A random generator to choose randomly between actor classes if there a multiple for one label.
CutHoleLabels
Labels for which the generated mesh should have holes. Only works with planes.
ProceduralMaterial
Material to apply on top of the procedural mesh if any.
ShouldFallbackToProcedural
Whether or not it should by default fallback to generating a procedural mesh if no actor class has been specified for a label.
Returns
The spawned actors.
Launch the scene capture. After a successful capture the scene should be updated.
Returns
Whether the capture was successful.
void Initialize
( FSubsystemCollectionBase & Collection )
void Deinitialize ( )
TSharedRef< FJsonObject > JsonSerialize ( )
void UnregisterRoom
( AMRUKRoom * Room )
FBox GetActorClassBounds
( TSubclassOf< AActor > Actor )
UOculusXRRoomLayoutManagerComponent * GetRoomLayoutManager ( )
Did you find this page helpful?
Thumbs up icon
Thumbs down icon