Announcement

Collapse
No announcement yet.

Supporting Vive Focus, Oculus and DayDream at the same time?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Supporting Vive Focus, Oculus and DayDream at the same time?

    Hello,
    I'm working on a VR mobile game made with UE4.21. I want to target the Oculus mobile, DayDream, WaveVR and Pico devices.
    To do that I just have to enable the plugin I need and build the game. But for some SDKs, I need to use some specific code. If I disable a SDK, blueprint nodes and C++ are not yet available (obviously). So the good solution is to create an abstraction that call specific SDKs function.
    For instance I want to do something like this:

    int MyWrapper::GetHandness()
    {
    #if OCULUS_DEFINED
    return OculusSDK::GetHandness();
    #elif DAYDREAM_DEFINED
    return Daydream::GetHandness();
    #elif WAVEVR_DEFINED
    // etc...
    #endif
    }

    And then make it callable to blueprint so I can develop cross-platform functions.

    Is it possible? How do you deal with many SDKs?

    Thank you!

    #2
    I didn't find a way to do it for our game - needed to create a separate branch for each.

    In theory you might be able to separate all specific SDK functions into their own blueprints and you load the relavent project from git or whereever to build but I never tried it.

    It is a pretty frustrating way the engine is setup handling mobilevr plugins. Better would have been for Epic to allow us to select which mobilevr plugin should be active when exporting
    Headgear - VR/AR solutions

    Comment


      #3
      I found another solution which is IMHO more acceptable. I don't use blueprint nodes of those SDK but instead I working on a big wrapper in C++ that exposes some nodes.

      For instance the interface of my c++ looks like that:

      Code:
      int GetHandness();
      bool Is3DOF();
      string GetLoadedDeviceName();
      Then in the sources, I just have to write something like that:

      Code:
      int VRWrapper::GetHandness()
      {
      #if OCULUS_SDK
           return OculusSDK::AFunction();
      #elif WAVEVR_SDK
           return WaveVRSDK::AFunction();
      #endif
      
           return 0;
      }
      Finally in MyProject.Build.cs I can change the definition required to build my game, for instance,
      Code:
      Definitions.Add("OCULUS_SDK");
      It's not perfect because you've to:
      1 - Disable and Enable the plugins for each platforms
      2 - Edit the MyProject.Build.cs script and change the definition required to compile the project with the selected plugin

      BUT it's the best way found to work on a crossplatform project using the same branch.

      It could be very very cool if the editor can provide a definition for each loaded plugins. Also a SDK selector could be the good solution

      Comment

      Working...
      X