Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Oculus rift VR headset positioning with Unity

Discussion in 'VR' started by nznbccc, Mar 2, 2023.

  1. nznbccc

    nznbccc

    Joined:
    Oct 30, 2022
    Posts:
    3
    Hi there,

    I am developing a scene in unity for a meta rift S headset and I am just wondering about how does the positioning and coordinate system work within the unity scene once I put on the VR headset.

    I am assuming once I am in the unity scene, everything for the VR would be in terms of the unity coordinates (so the headset's positioning system would follow the scene, please advise if this is not the case) but where would be the origin (0,0) of the scene in headset? And is there anyway I can extract the raw data of the x, y, z, and possibly the quaternions of the controllers and the headsets while using the headset? I want to use these position data and map it onto a device in the physical world through ROS.

    Thanks for any help and advise in advance!
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,251
    I kinda lost you. You can make a very simple scene in under 10 minutes with an XR rig, just try it and you can see the scene in real time in Unity.

    And yep, you can read out the position and rotation of the devices
     
  3. nznbccc

    nznbccc

    Joined:
    Oct 30, 2022
    Posts:
    3
    Thanks a lot for your comment!

    Ya I already have a scene, but what I am trying to do is to map out each of the headset controller's position with respect to a common coordinate system and send that to a robot in real life through ROS so that the robot can move to a certain location accordingly. So I know that the oculus quest has its own coordinate system and the Unity scene would have its own coordinate system as well. So would everything just be aligned in terms of the unity scene's coordinate system once in the Unity scene and if so, where would be the origin, would it be where my headset camera rig is?

    Sorry if I am not explaining it very well and again, much appreciated for any advise and help!
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,251
    Unity's origin is 0,0,0 in the scene. It's in meters by default
    Maybe you can cache the VR position in Start()? Then calculate differences between that pos and the current pos?
     
  5. nznbccc

    nznbccc

    Joined:
    Oct 30, 2022
    Posts:
    3
    Okay cool thanks a lot for your help! Just to confirm, once the headset is in the unity scene, it would follow the coordinate system within unity and whatever object I assign the headset camera rig to would be its position of headset with respect to the origin in the unity scene. And that would apply for the controllers as well, the controllers prefabs within the scene's position would be the position with respect to the coordinate system within unity itself. The headset's positioning system would not contribute since it is in a scene in Unity. Thanks again!!