When I run a game in VR and load another map the camera gets stuck way below the floor, even though the pawn’s location is the same. It looks fine on the first map that starts when preview starts, but gets messed up after opening a level.
This issue happens only when using Oculus Rift (I am using CV1) and UE 4.18. Everything looks fine in Vive on 4.18 and in both headsets on 4.16 and 4.17. What is more annoying is that in the problematic case loading a level takes so long that packaged build just gives up after 30 seconds.
What I have tried
To see whether this is fault of maps I am using or VR pawn I have been developing I tried to import pawn blueprints straight from the VR template to a project with only these maps and I have also built two basically empty maps (one has slightly rotated floor just to be different).
Result
When using Rift (on 4.18), the camera gets stuck below the floor after loading a level once and stays that way for subsequent loads until restarting the preview. Navmesh shows up properly and pawn actor’s location also is no different from when the camera is on the right height. Teleportation marker is shown also on the proper level. It is just the camera that is too low (180 units if I recall correctly).
When it works fine
On 4.16 and 4.17 in both Vive and Rift and on 4.18 in Vive.
Finishg words
From what I’ve seen, lots of people seem to complain about 4.18 and its VR support, so it seems like I am not alone, however due to work circumstances I am not able to rollback to 4.17, so I would love to get some support on fixing the issue here, on 4.18.
If you converted a project based on the VR Template from 4.17, there was a known bug on the detection of the Oculus Rift such that the Tracking Origin was not properly set to Floor Level. That resulted in the camera being stuck on the floor.
Another possibility is that your Pawn is somehow not setup correctly or you forgot to set the Tracking Origin which, on the Rift, defaults to Eye Level.
Can you post some screenshots of your Blueprints, especially the setup of the VR Pawn?
I know about the change from “OculusRift” to “OculusHMD” when setting up the tracking origin. The only other part of my pawn’s setup is just teleporting it to a nearest floor, so I do not think that is the culprit. I attached screenshots of these two parts.
I will just reiterate that eye level gets messed up only after opening another map during gameplay (which is preceded by extremely long loading time), and only on Rift.
Also, the problem does not exist during first preview in editor, only in every subsequent preview session and always in packaged build.
After few more minutes of searching I found out that tracking origin is indeed not being set properly in problematic cases, even though “Get HMD Device Name” returns correct value and “Set tracking origin” seems to execute on pawn’s begin play after level loads.
If you want to share your project or part of it showing the issue I am happy to take a look. I also see from your Blueprint that you are teleporting the Pawn to the linetrace impact point. Depending on how your pawn is setup, this may offset its Z world location and place it lower on the floor. Try to preserve its current Z world location when teleporting and just alter X and Y.
I am not really able to share my project too much, so I will have to skip on your offer.
However, from what I have seen yesterday, it seems like after these problematic long level loads, tracking origin is not being set to “Floor level”. Forcing it to this value fixes the wrong camera offset but it does not fix unbelievably long loading times (which are the bigger problem).
So it is likely not caused by a mistake in, let’s say my code. I have no idea what to do for now other than “dropping” support for Rift temporarily and counting on 4.19 to resolve the issues.
If you suspect your project to be somehow corrupted (e.g. long loading times), you can try to Migrate… your levels to a new one and see whether this fixes it.
I have tried migrating the levels to a clean project made from VR template and I have also tried migrating unedited VR template blueprints to a project containing empty test levels. Nothing has helped.
The problem still exists in today’s promoted git release of the engine.
Then I am out of suggestions sorry! Try to open a Bug Report and have someone from Epic look into it. This said, if you are not able to produce/share a sample project showing the issue, I am afraid it is going to be difficult for everyone to try to help you. Good luck with your project.
Note that the stall doesn’t seem to happen in cooked game, nor does it happen if the maps used are very simple. Before I figure how what the actual problem is, our temporary solution is to disable the Oculus splash code path in the editor…
Wow, that is a reply I have not expected. Disabling this Oculus splash thing does indeed solve the problem! This definitely qualifies as the best answer
I am not sure however what exactly I am losing by doing that…
By the way, in my case, this long execution was happening even on maps as simple as just cube, light and pawn and/or in fully cooked and packaged game.
We’re having the same problem in the project and I’ve tracked the issue to a very long call to ovrp_WaitToBeginFrame in the Oculus splash code. I timed the code around the call like this:
auto beginTime = FDateTime::UtcNow();
ovrp_WaitToBeginFrame(XFrame->FrameNumber);
auto duration = FDateTime::UtcNow() - beginTime;
UE_LOG(LogTemp, Log, TEXT("ovrp_WaitToBeginFrame takes %.2f sec"), (float)duration.GetTotalSeconds());
And as you can see from the log, there’s a call that takes 30s to finish.
I know this is marked as resolved, but I’ve been having this problem and it wasn’t fixed by disabling the Oculus Splash.
In the end, I added a ‘Set Tracking Origin’ node on Begin Play
I know this is marked as resolved, but I’ve been having this problem and it wasn’t fixed by disabling the Oculus Splash.
In the end, I added a ‘Set Tracking Origin’ node on Begin Play
This issue is causing a lot of grief. I am wondering if anyone could give some advice.Maffew, where did you put the “set Tracking Origin” node for it to help? I have this in the EventBeginPlay of the pawn, but have tried in the level blueprint and gameInstance.
It seems i am having this issue while trying to use stereo layers with Oculus. There is no problem on the vive. it works fine the first time in a PIE session. but trying again, or trying in a packaged build has a 30~ second delay, with the pawn’s VRcamera often at floor level.
In my case added small delay in the begin play fixed an issue. My headset wasn’t detected at start so proper height adjustment couldn’t be done. With 0.5 delay works perfectly on Quest 2 in PC VR mode (through the cable).