Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
ikrima's avatar
ikrima
Honored Guest
10 years ago

BUG + Workaround: VR Preview disabled in 4.10p2 + 0.8.0 SDK

If you're using the latest integration from Oculus (0.8.0 SDK) with UE4.10p2, there's a bug in the initialization code that prevents VR preview from working in the editor. Add the section within the comments for workaround in [UE4 Root]\Engine\Plugins\Runtime\OculusRift\Source\OculusRift\Private\OculusRiftHMD.cpp


virtual TSharedPtr< class IHeadMountedDisplay, ESPMode::ThreadSafe > CreateHeadMountedDisplay() override
{
#if OCULUS_RIFT_SUPPORTED_PLATFORMS

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//BUG: ikrimae: Under Editor mode, Initialize() is called in FOculusRiftPlugin::PreInit() but it's called before the FEngineLoop::PreInit() sets GIsEditor to false.
// This causes it to try to initialize the headset before it's ready and it fails. And then when we need to create the HMD in this function, this gets
// bypassed bc bInitializeCalled == true
// Workaround: Force it to create the hmd

#if WITH_EDITOR
if (bInitializeCalled == true && bInitialized == false)
{
bInitializeCalled = false;
}
#endif // WITH_EDITOR
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

8 Replies

Replies have been turned off for this discussion
  • Thanks for the heads up ikrima.

    Im just downloading 4.10 ATM and this work around will save me from bashing my head against my desk. :D
  • Are you using the official UE4 source, or the Oculus fork? Because this may be fixed already in the Oculus version.
  • ikrima's avatar
    ikrima
    Honored Guest
    "cybereality" wrote:
    Are you using the official UE4 source, or the Oculus fork? Because this may be fixed already in the Oculus version.


    This is in the latest Oculus fork; the mainline branch may or may not be broken. Haven't tested that
  • mirkoj's avatar
    mirkoj
    Honored Guest
    sry where to add what? :) please a bit of help :)
  • Buzz001's avatar
    Buzz001
    Honored Guest
    Hi guys,

    I've been banging my head against the wall for two days now and can't figure it out. I'd really appreciate some advice.

    Everything was working fine up until last week. I am using runtime version 0.6.0.1 because any new version displays the HMD not connected error. I also tried installing engine 4.10 this week and I may have had a windows update.

    Initially my problems started where turning my head in unreal would cause my player to side step left and right. This started happening in every one of my projects and even brand new projects.

    Tried 4.10 of unreal, same problem.
    Removed 4.10, same problem.
    Reinstalled 4.9, lost the ability to use VR Preview but Oculus is identified by the config utility and I can run the demo scene.
    Tried every combination of driver I can think of, updated graphics, tried different engines, rolled back windows update, reinstalled Epic Games Launcher, tried every display configuration, tried every USB configuration, even tried a brand new oculus rift DK2. Still don't have VR Preview in anything.

    If I show log then type in ovrversion, I get ovrversion is not recognised.
    I've tried putting the code above for both 4.9 and 4.10 and it's not made any difference.
    Turning the plugins off and on makes no difference
    Toggling on simpleHMD plugin does enable the VR preview button but only for the SimpleHMD view.

    I'm considering a reformat of my machine but would really rather avoid the hassle if possible.
  • I believe you need a newer Runtime to use 4.10, so that part makes sense.

    Not sure why you can't revert, though.
  • Buzz001's avatar
    Buzz001
    Honored Guest
    Thanks for replying cybereality. I think I've figured it out now so if anyone else is having a similar problem.

    - My PC isn't compatible with Oculus so that's probably why a runtime newer than v0.6.0.1 does not recognise my oculus rift. (Although v0.6.0.1 works perfectly fine with my elderly PC!)

    - It seems Unreal 4.9.1 and newer engines dropped support for runtime v0.6.0.1 so that is why I lost my ability to use VR Preview when I installed 4.9.2 in a bid to fix an unrelated problem.

    - Installing engine 4.8.3 with runtime v0.6.0.1 works as normal and as it always has done.

    - The issue now is that my project is 4.9 and I can only download 4.9.2. So I either need to buy a new PC (not ideal and may not fix the issue), find a way of getting 4.9 back on my machine, or rebuild the entire project in 4.8.3.
  • KristaJ's avatar
    KristaJ
    Honored Guest
    Thank you Ikrima, your solution works for me (UE 4.9.2, Oculus 0.7.0 SDK)