Search Unity

[Oculus DK2] when virtual reality enabled, I want to disable HMD tracking

Discussion in 'AR/VR (XR) Discussion' started by bhaptics, Jun 23, 2015.

  1. bhaptics

    bhaptics

    Joined:
    May 22, 2015
    Posts:
    1
    Is there HMD tracking off option?
    What I want is that view is not chaged even when there is VR movement.

    Thank you in advance.
     
  2. Kevin.Ferravanti

    Kevin.Ferravanti

    Joined:
    Aug 31, 2012
    Posts:
    18
    Unfortunately, "For now you must use Oculus’ SDK in order to obtain the movement volume or lock movement. This will be exposed through Unity in the future.".

    Quote taken from http://docs.unity3d.com/Manual/VROverview.html

    so if you're using Unity's VR then you cannot lock movement as of right now.
    but if you're still using the OVR integration plugins, you can, it's a setting on their Manager.
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    Not sure what you would use that for, but a word of caution as doing so will make the user uncomfortable.
     
  4. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    Controlling where the camera actually is is pretty essential to a lot of/MOST games. Tuning these effects seems to be quite essential.
     
  5. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    Yeah, but doing so on an HMD is not a comfortable experience.
     
  6. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    311
    You can control the camera when VR is enabled if you make it a child or another object and then move the parent object. Doing this will not make the user feel uncomfortable so long as the user is not moving around in real space.

    Restricting HMD tracking will however make the user feel very uncomfortable because they will move their head, but the image they are seeing will not shift in any way. Doing this with an image that is not black will cause a lot of discomfort.
     
  7. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I agree, it would not feel good for the user, but if you still want to do this. Add a script to the parent object of the camera that counteracts the movement of the camera from the sensor. read the camera transform values. if it moves up, move the parent down with the same amount... same with rotation... Not an ideal way to do it but it will work.
     
  8. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    Doesn't this need to be tunable though? ie how far the camera moves when someone moves their head. This should be adaptable to the scale of the scene. Like what do you do during a cutscene where the camera is not supposed to move? How do you stop people from poking their head's through walls?
     
  9. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    311
    Using the Parent object of the Camera, you can control the scale, position and rotation of the Camera. This allows you to adapt the camera to the scene like you suggest. If you scale the parent down, the camera will move less with the head tracking relative to the rest of the world. If you scale it up, the camera will move more relative to the world.

    I can think of a few cut scene examples in which position tracking might not be desired, but even in the examples I can think of, the scene would not be setup in a way in which the user could "poke their head's through walls" as you suggest.

    For example a scene in which the player is captive. Maybe similar to the first scene of The Elder Scrolls: Skyrim, if you have played that. In this scene, the user should be able to rotate and move their head slightly as if leaning and looking around the world. And at no point in this cut scene would the player be able to move their head through a wall.

    Another example, a cut scene where the camera is flying over a town or village and the user can look around to see different area's of the village, or something similar, maybe the camera is flying through a dungeon showing the user the path ahead. In both instances, maybe the camera wouldn't need positional tracking, but even if the positional tracking was present, the camera would never be positioned in such a way that it would go through another object or wall.

    I can understand why you might not necessarily need positional tracking in all cases, but removing it all together can make the user feel sick. So as a best practice, your world would be designed with that in mind.

    If you have a really good example scene or scenario in which positional and rotational tracking wouldn't be used, I would be interested to hear. We are open to adding functionality, but we want to keep in mind the best practices for VR so that it isn't easy to make the user feel uncomfortable by accident.
     
  10. Torigas

    Torigas

    Joined:
    Jan 1, 2014
    Posts:
    63
  11. float

    float

    Joined:
    Jul 29, 2012
    Posts:
    42
    Dear Unity-Ppl
    You are making an engine. Not gameplay-decisions and not best-practice rules for us!
    Stop that at once!!!
    Open every aspect of it so we can code what ever we want, like it should be. Nobody has to justify anything to you.
     
    ddubinks17 and FenyceAssets like this.
  12. rorys88888888

    rorys88888888

    Joined:
    Jul 28, 2015
    Posts:
    3

    I have a use... I have two cameras in my game, one camera I need to have head tracking and the other camera I need the head tracking disabled... the camera where there is head tracking is what the player sees (so they can look around the environment) and the other I am using for a raycasting and I DON'T want it to move when the player moves their head..... has there been a recent development and is there a way to disable head movement from a camera in the updated unity? Thank you!
     
  13. bfloch

    bfloch

    Joined:
    Jan 4, 2013
    Posts:
    24
    I have to agree with float although I would not put it that radically :-D

    I mean in regular 3D games camera shakes are not the nicest thing to do to an player either, but still you wouldn't want the engine make the decision for you.

    I can think of many ways where freezing the pos-tracker could be useful. I've seen this being requested for quite some time now. I have personally a case where I want the player to start of with a static image of the scene which explains a few things, but now I have to render it in to a texture ...

    What about a game where you make photographs as freeze frames? Yes I totally understand your worries about the comfort of our players but last time I checked this was our job, no?

    Or a POV game where your mafia boss grabs your head and points it directly at his face. Yeah probably weird to be forced to look into a direction that you are not really looking at, but maybe that is the intended feeling. Who knows? Give us the possibility to find out and maybe fail.

    Last but not least here the craziest use case ever: I don't put on the glasses every 5 seconds when I want to test something. Sometimes I forget to direct the glasses on my desk to the front and I see nothing (the floor). Wish I had a toggle to disable the tracking ingame, so I wouldn't need to care about how the glasses lay around on my desk. Yes I could always dig down to the settings and disable VR but this decision does more than intended.

    Anyhow we can all agree the the whole VR things is pretty new to all of us and I'm totally on Unity's side when it comes to best practices to keep people healthy. Just I wouldn't make technical restrictions to enforce it. You never know how and for what people use the hardware.

    Btw. thanks for the hard work that has been done in 5.1 for VR. We are on a project with a tight deadline and every week I feel a bit better.
     
    Last edited: Aug 6, 2015
    Pawige likes this.
  14. RyuHayaboosa

    RyuHayaboosa

    Joined:
    Mar 8, 2015
    Posts:
    14
    I have a simulation where I use other trackers for full body motion, including the head. Not being able to turn off Oculus' tracking is making this a real pain. Please let us do it!
     
    CloudyVR and BrenusTanthul like this.
  15. Nick-at-AccuPS

    Nick-at-AccuPS

    Joined:
    Jan 23, 2016
    Posts:
    6
    Seconding this as a problem for testing alternative hardware tracking.
     
    BrenusTanthul likes this.
  16. BrenusTanthul

    BrenusTanthul

    Joined:
    Jul 21, 2015
    Posts:
    1
    I work in a motion capture lab at the Ohio State University's Advanced Computing Center for the Arts and Design and we came up against the same problem that RyuHayaboosa mentioned. Our Vicon motion capture system was taking care of position/rotation tracking (piped in to Unity via Vicon's Pegasus software). The built in Unity VR was adding to and disrupting our mocap rotations.

    We tried:
    1) Disabling rotations from Vicon and just using Oculus rotations. Gryoscope/accelerometer data drifts, which caused loss of reliable user to virtual environment orientation.
    2) Parenting a quad with a render texure of the motion capture camera to the Oculus camera, but there were distortions when the Oculus rotated on the z axis.
    3) Zeroing out position and rotation in LateUpdate(), but that seemed to have no effect at all.
    4) We ended up disabling Unity VR, downgrading the Oculus runtime to 0.6.1.0 so we could use Extended Display Mode, and used Google Cardboard's SDK to create a stereoscopic display.

    Being able to disable rotation/position tracking would have made this much simpler.
     
    FenyceAssets likes this.
  17. GoesTo11

    GoesTo11

    Joined:
    Jul 22, 2014
    Posts:
    604
    The Sixense SDK uses their trackers instead of the Oculus ones so it is possible.
     
  18. SebiH

    SebiH

    Joined:
    Apr 23, 2016
    Posts:
    1
    Since this is the top result when searching for disabling oculus position tracking in Unity, and I was looking for this exact thing:
    It's now possible to disable position tracking with the latest Unity editor (5.3.4p1 - 5.3.4p4), Oculus SDK 1.3 with the updated OVRPlugin and Oculus Utilities for Unity (not necessary, but easier). See this post for more information on that.

    You'll have to use the OVRCameraRig Prefab provided by Oculus Utilites and turn off Use Position Tracking to.. well, turn off position tracking. This'll keep the camera in one place, but keeps orientation tracking intact. You can turn off rotation tracking by digging into the provided scripts a little.

    Alternatively, one can use this script to disable both without the Oculus Utilities:

    Code (CSharp):
    1.  
    2.     [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
    3.     private static extern int ovrp_SetCaps(int caps);
    4.  
    5.     void Start()
    6.     {
    7.         // disable position tracking
    8.         ovrp_SetCaps(14);
    9.         // disable rotation tracking
    10.         ovrp_SetCaps(6);
    11.     }
    12.  
    Edit: Just noticed, disabling rotation tracking will cause Oculus to display unity's scene as a floating 2D window, so if you look around you'll see black space. Probably needs another solution to disable rotation.

    Edit2: Adding

    Code (CSharp):
    1.  
    2. trackingSpace.FromOVRPose(centerEyeAnchor.ToOVRPose(true).Inverse());
    3.  
    at the end of OVRCameraRig.cs / UpdateAnchors() from the Oculus Utilities knocks out orientation, too. There's a slight wobble in the Editor window, but it was barely (it at all) noticeable in the DK2. Taken from here
     
    Last edited: Apr 23, 2016
    JVLVince likes this.
  19. Rogue_Guardian_Studios

    Rogue_Guardian_Studios

    Joined:
    Feb 12, 2015
    Posts:
    11
    Wouldn't it be easier to just make the camera that you don't want to move a child of an empty OBJ. Then on the parent OBJ and a script to counter the rotation of the head. (I use this and it works)

    Code (CSharp):
    1.  
    2. //Requires using UnityEngine.VR
    3.  
    4. Quaternion startRot;
    5.     Quaternion HeadRot;
    6.  
    7.  
    8.     // Use this for initialization
    9.     void Start () {
    10.         startRot = transform.rotation;
    11.  
    12.  
    13.     }
    14.    
    15.     // Update is called once per frame
    16.     void Update () {
    17.    
    18.         transform.rotation = startRot * Quaternion.Inverse (InputTracking.GetLocalRotation (VRNode.CenterEye));
    19.  
    20.     }
     
    roetka likes this.
  20. bmcternanNS

    bmcternanNS

    Joined:
    May 12, 2016
    Posts:
    1
    I have another use case: I have two displays - one for the person wearing the Oculus HMD and one for multiple people who are viewing the scene on a second monitor. I want the people viewing from the second monitor to not be affected by the HMD wearer's head motion. Even if I use multiple displays and set the target eyes appropriately, the HMD rotation still affects the second display!
    I've tried the inverse option that Rogue_Guardian_Studios recommends, but there is clearly some synchronicity problem. Every time the HMD is moved there is judder in the other display.
    Any ideas?
     
  21. JVLVince

    JVLVince

    Joined:
    Jul 20, 2016
    Posts:
    29
    I know this post was old but I have to thank you, you saved my day. :D
    A small question, can you teach me how to know or view the ovrp_SetCaps function please? I tried to used dotPeek to decompile the OVRPlugin.dll file but it's give error and I can not se any things.
    Thanks again. :D