06-13-2019 08:09 AM
Recenter
function. So I am currently trying to develop on the rift, and then building on the Quest. However, I am facing a problem, when I call the recenter function on the rift, everything works perfectly and as intended. However, when I test it on the Quest, the function does not seem to work at all. Does anyone have the same thing?
If it matters, I'm using Unity 2018.4.0f1 LTS
Thanks all!
02-03-2021 02:52 AM
02-06-2021 12:18 PM
06-20-2021 08:49 PM
if you dont mind the users still using the oculus home to reset orientation. you can also include your own code to be called when it is pressed by using this.
void Start()
{
OVRManager.display.RecenteredPose += PlayerPressedOculusHome;
}
public void PlayerPressedOculusHome()
{
Debug.Log("I Have Detected a headset Reset");
}
04-01-2022 06:38 PM - edited 04-01-2022 06:40 PM
Hey SergantTeddy! That tip was awesome, and worked perfectly for what I needed, thanks so much! I have a strange thing with it though, maybe you have some insight?
It works perfectly, the first time I do it... but subsequent resets of the orientation starts an explosion of errors though:
MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
CocklpitBoundingMagic.PlayerPressedOculusHome () (at Assets/Scripts/CockpitModeStuff/CocklpitBoundingMagic.cs:47)
OVRDisplay.Update () (at Assets/Oculus/VR/Scripts/OVRDisplay.cs:125)
OVRManager.Update () (at Assets/Oculus/VR/Scripts/OVRManager.cs:1818)
SO... I assumed maybe this was a case of "I'm piggybanking off this OVRManager, but when I reset the view, that gets deleted or something, so my connection to the old one is now invalid".
I think there's some validity to that theory because I tried redoing the:
"OVRManager.display.RecenteredPose += PlayerPressedOculusHome;"
line every time I reset the view, and that fixes that error, presumably because it's resetting the connection to the newer element, but it only works as long as I have that script open and running forever in the project, haha. Not great.
So yeah, any alternate or more stable ways to try and detect an orientation reset? Thanks in advance if so 🙂
09-24-2022 10:11 AM
I wish those events would work! But for me, none of the two fire when re-centering the view on the Quest 2. Neither in stationary nor roomscale boundary.
04-30-2023 07:24 AM
Still struggeliing but and the other post no longer available 😕
What was the fix please ?
thanks
06-26-2024 08:05 PM - edited 09-14-2024 04:26 AM
I have the same problem when developing a game player can sit to play, so the head pose recenter is every useful when loading a new scene.
After digging more about those APIs, I found none of them works on my quest 2, so decide to recenter it by myself. The code is sample:
1. Record the FIRST head position and rotation.
2. Add a parent root for both head and hand gameobject, call it TrackingSpace.
3. Set the position (Quaternion.Inverse(FirstHeadRotation) * -FirstHeadPosition) and rotation Quaternion.Inverse(FirstHeadRotation) to TrackingSpace.
4. Then set head and hand position normally(directly from OVRInput or InputSystem).
In order to make height of head take effect, I set the Y axis of FirstHeadPosition to zero in step 3, so player could still put their head lower or higher.
Also, if player long press menu button from controller to reset the view, I also can't get called from RecenteredPose callback from SDK, but fortunately, I found OVRPlugin.GetLocalTrackingSpaceRecenterCount() will plus 1 every time I reset the view form controller, so I can check this to decide to record the latest position and rotation as FIRST head position and rotation, and then set them to TrackingSpace to finish the reset view inside game.
Hope those helps.
12-07-2024 01:20 AM
Very helpful and useful! Thanks for saving me a lot of time!