cancel
Showing results for 
Search instead for 
Did you mean: 

Oculus Unity - Reset Pose , without resetting the rotation

HashBuoy
Explorer
I am working on a VR game using Oculus Rift utlities plugin 1.6.0 (https://developer.oculus.com/downloads/game-engines/1.6.0/Oculus_Utilities_for_Unity_5/) and Unity 5.4.0f3.

The biggest problem I am currently facing is with the player reset position.
So basically if the player moves back beyond a particular direction or moves into a wall, then the head gets snapped back to the root origin of the OvrPlayerController(root) Object.
Please refer to this video link for better understanding of the functionality.
(https://www.dropbox.com/s/t208phk2bg6rhe5/adrift.mp4?dl=0)

I am trying to achieve this using `OVRManager.display.RecenterPose();`
which looks like this 

    public void RecenterPose()
    {
        VR.InputTracking.Recenter();
    
        if (RecenteredPose != null)
        {
             RecenteredPose();
        }
    }

This works fine the head gets snapped back to the origin (root position). But this also resets the rotation which looks a weird. Is there an alternate path to just reset the position leaving the rotation as it is ??
4 REPLIES 4

cybereality
Grand Champion
First, this should be in the Developer forum in the Unity section. You can switch forums using the drop-down menu on the top-right. I'll move it though.

To answer your question, the Recenter function should not be used like that. That function is used so the player can calibrate where they want the center of the world, and their forward direction to be located in. It should not be used for game specific functions, like clipping geometry or collision.

Additionally, moving the player's head position automatically, like due to touching a wall, will cause discomfort and disorientation. If your goal is to avoid the player looking though walls, then it is better to fade the screen black or display some sort of warning message instead.

HashBuoy
Explorer
Hey , thanks for moving it to the appropriate thread.
I agree to the fact that it will create discomfort to the player and is not a good solution.
But this scenario doesn't occur too often, and we really need this to maintain impressiveness in the game.
Also the video reference for this functionality is from the game called 'Adrift' (link: https://www.youtube.com/watch?v=KxMpadZIMQQ ).
If there is any way to achieve this , then please let me know.
Thanks

vrdaveb
Oculus Staff
Rather than calling RecenterPose, try moving OVRCameraRig.trackingSpace.position. For example, you could set myRig.trackingSpace.position = myRig.centerEyeAnchor.position to reset the position but not the orientation.

HashBuoy
Explorer
Hey , that was pretty close . It set me up on the right path , i tweaked the formula a bit 
myRig.trackingSpace.position = myRig.trackingSpace.position - myRig.centerEyeAnchor.localPosition ;

This works but not in best sense for some reason, rotation is off beat .
Anyways thanks for helping , will figure out something.