Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
IseTM's avatar
IseTM
Explorer
2 years ago
Solved

MRUK Create a new Scene

The documentation (Docs Link) says:

  • Using Mixed Reality Utility Kit, the function MRUKRoom.IsPositionInRoom(Vector3 pos) can be used to check whether the camera rig pose is present in the loaded scene or not. If it is not, offer users to capture a new scene.

How can I create a new room with MRUK? 

9 Replies

  • Boarward's avatar
    Boarward
    Honored Guest

    You can use OVRScene.RequestSpaceSetup()

    • IseTM's avatar
      IseTM
      Explorer

      I saw that on the latest docs, I think it was added with the v65 or v66

  • Hi,

    I have a scene that is working in one room and I would like it to rescan the scene or load a new scene from the device if I move into a new physical room (scanned and present on the device).

    I am debugging the efficiency of  MRUKRoom.IsPositionInRoom(Vector3 pos) by recoloring the EffectMesh...

    But the below code does not what it should... Any Meta ppl can help??? Please...

     

     

      if (!isInRoom)
                    {
                        _effectMesh.MeshMaterial.color = Color.green;
                        MRUK.Instance.ClearScene();
                        MRUK.Instance.LoadSceneFromDevice();
    }

     

     

     Thank you.

    GL

  • Hi, I have a scene that is working in one room and I would like it to rescan the scene or load a new scene from the device if I move into a new physical room (scanned and present on the device).

    I am debugging the efficiency of  MRUKRoom.IsPositionInRoom(Vector3 pos) by recoloring the EffectMesh...

    But the below code does not what it should... Any Meta ppl can help??? Please...

     

     

      if (!isInRoom)
                    {
                        _effectMesh.MeshMaterial.color = Color.green;
                        MRUK.Instance.ClearScene();
                        MRUK.Instance.LoadSceneFromDevice();
    }

     

     

     Thank you.

    GL

  • In Unreal, using MRUK v64, it is as simple as calling MRUKSubsystem.LaunchSceneCapture().  Sorry, I don't know the equivalent in Unity.  But maybe the function is named similarly.

    Edited:

    Looking at the Unity documentation, it says you should have an MRUK prefab in your scene.  I'm guessing that MRUK singleton is equivalent to Unreal's MRUKSubsystem.  If so, I'd think you would call something akin to LaunchSceneCapture on that singleton.  Hopefully some knowledgeable Unity developers will jump in here and clear things up!  🙂 

  • Note: I am an Unreal developer, so I apologize if any of this is slightly different to Unity.

    You do not create rooms with MRUK, rather MRUK helps get access to rooms that are saved on your headset via the Space Setup app (Settings -> Physical Space -> Space Setup).  Setting up the room includes scanning the room to create a 3D mesh representation as well as adjusting planes and adding volumes to represent semantically labelled objects, like walls, floor, tables, etc.  This is a completely separate process from your app and can be done prior to running your app.  If your app finds no saved room during runtime (i.e. Load Scene fails), you can launch the Space Setup app from inside your app, complete the process, and it will return control to your app, at which time you can use MRUK to access the data.

    MRUK also has helper functions to convert a loaded Scene (i.e. room) to a JSON string and load the JSON back again into a Scene, as if it came from the headset.  This can be useful for debugging or learning, and the MRUtilityKitSample project has examples of this.  I highly recommend checking out the sample, as it also shows how to request the necessary user permissions to access the Scene data.

    Once your app has received permission and loaded the Scene from the device, you can do something like MRUKSubsystem.GetCurrentRoom.IsPositionInRoom() to check if a position is inside the walls/floor/ceiling volume.

    • IseTM's avatar
      IseTM
      Explorer

      With the OVRSceneManager there is a method to do the scan of the room during tha game. With MRUK I didn’t find anything like that.