Official VR module


#88

Hello,

Yes it’s a bug from the last commit. I will correct it this week but to avoid it, you can comment VR settings related to GUI within the Application initialization:

settings.put(VRConstants.SETTING_GUI_CURVED_SURFACE, true); // Curve the mesh that is displaying the GUI
settings.put(VRConstants.SETTING_GUI_OVERDRAW, true); // show gui even if it is behind things.


#89

When will this module be incorporated into the standard distribution of the jME SDK? The VR jar is not currently distributed with it. Thank you.


#90

At this time jme3-vr module only works with lwjgl3, i think this is the limitation that does not enable to integrate it to the SDK…


#91

Hello,
I am able to run the VRSample program with the last update of the module included from seinturier’s November, 2017 post however no matter what I try and can’t get my htc vive wands to display even after i turn both of them on. Has anyone gotten the wands to work with the newer code? The location/rotation returned by the wand is always null. i was able to get values that isnt null from the wand when debug stepping through the code but only once. i think something is possibly not getting initialized until later based on the fact that i was able to get a value that isn’t null only when debugging through the code.

The only difference is there are some properties i did not set in my code within main because they would cause a crash under my windows 10 setup

Thank You


#92

i got it working. the sample provided assumes VR is already turned on. I’m not sure how efficient or not what i did is but I was able to fix the issue by calling the following within the handleWandInput method;

vrAppState.getVRinput().updateConnectedControllers();

I would imagine i can make it slightly more efficient by moving this call to the simpleUpdate method so it is called half as often.

Is this the most efficient way of updating the connected controllers available? I want to take into account that they could turn one or both on and off as they please.

Thanks again it was pretty awesome being able to play around with that little test class you created in Java. Now the real fun begins :slight_smile:


#93

I just grabbed the release for 3.2.1 stable, and I cannot find the jme3-vr module in it… Is the module going to be included in the release? I see it in the repo under the v3.2 branch.


#94

Just trying to run the example vr app and marry it up to an oculus rift, but getting this error when trying to build.

Exception in thread “main” java.lang.IllegalStateException: Pointer native@0x7ff895dec728 already mapped to Proxy interface to native function@0x7ff895dec728 (com.jme3.system.jopenvr.VR_IVRSystem_FnTable$ComputeDistortion_callback).
Native code may be re-using a default function pointer, in which case you may need to use a common Callback class wherever the function pointer is reused.
at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:148)
at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:131)
at com.sun.jna.Pointer.getValue(Pointer.java:425)
at com.sun.jna.Structure.readField(Structure.java:720)
at com.sun.jna.Structure.read(Structure.java:580)
at com.jme3.input.vr.openvr.OpenVR.initialize(OpenVR.java:202)
at com.jme3.app.VREnvironment.initialize(VREnvironment.java:478)
at mygame.Main.main(Main.java:24)
C:\Users\Henry\Documents\jmonkey\sdk\build\testuserdir\var\cache\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 5 seconds)

Can someone advise how to overcome this?


#95

Hello,

try to change the line

settings.put(VRConstants.SETTING_VRAPI, VRConstants.SETTING_VRAPI_OPENVR_VALUE); // The VR api to use (need to be present on the system)

into

settings.put(VRConstants.SETTING_VRAPI, VRConstants.SETTING_VRAPI_OSVR_VALUE); // The VR api to use (need to be present on the system)

It seems that the system try to use an OpenVR device.


#96

I am getting this error as well:

Exception in thread “main” java.lang.IllegalStateException: Pointer native@0x7ffe3ac60560 already mapped to Proxy interface to native function@0x7ffe3ac60560 (com.jme3.system.jopenvr.VR_IVRSystem_FnTable$ComputeDistortion_callback).
Native code may be re-using a default function pointer, in which case you may need to use a common Callback class wherever the function pointer is reused.
at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:148)
at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:131)
at com.sun.jna.Pointer.getValue(Pointer.java:425)
at com.sun.jna.Structure.readField(Structure.java:720)
at com.sun.jna.Structure.read(Structure.java:580)
at com.jme3.input.vr.openvr.OpenVR.initialize(OpenVR.java:202)
at com.jme3.app.VREnvironment.initialize(VREnvironment.java:477)
at mygame.Main.main(Main.java:36)
I tried the recommended line change:
settings.put(VRConstants.SETTING_VRAPI, VRConstants.SETTING_VRAPI_OSVR_VALUE); // The VR api to use (need to be present on the system)
I got this error:
Exception in thread “main” java.lang.UnsatisfiedLinkError: The specified module could not be found.

at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:288)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:427)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:369)
at com.jme3.system.osvr.osvrclientkit.OsvrClientKitLibrary.<clinit>(OsvrClientKitLibrary.java:17)
at com.jme3.input.vr.osvr.OSVR.initialize(OSVR.java:152)
at com.jme3.app.VREnvironment.initialize(VREnvironment.java:477)
at mygame.Main.main(Main.java:36)

It seems to fail connecting to the native libs? When will the VR be in the stable release? Or is there a step by step way to assure the JME SDK environment is configured properly?
I have attemped to determine the steps from the forum and I must not understand the latest correct steps to build and use the VR development system.
Any guidance is welcome.
Regards
DBM


#97

Could this have something to do with the JNA ? is there a particular jna.jar or dll that need to be in the working directory?


#98

Just to be clear: You intend to use an OSVR headset?

Edit:

Reading up on the previous posts. If it is an oculus rift @xefox and @dbmapit are using, the setting should be:
settings.put(VRConstants.SETTING_VRAPI, SETTING_VRAPI_OCULUSVR_VALUE);


#99

No I’m using an HTC Vive and SteamVR I believe it is OpenVR.


#100

then you can use either
SETTING_VRAPI_OPENVR_VALUE

or SETTING_VRAPI_OPENVR_LWJGL_VALUE
if JNA is giving you trouble or you want to tap into LWJGL directly.


#101

Firstly thank you for you time.

  1. When I run the following main function with out the headset plugged in:

public static void main(String[] args) {

AppSettings settings = new AppSettings(true);

settings.put(VRConstants.SETTING_VRAPI, VRConstants.SETTING_VRAPI_OPENVR_VALUE);

settings.put(VRConstants.SETTING_ENABLE_MIRROR_WINDOW, true);

VREnvironment env = new VREnvironment(settings);

env.initialize();

// Checking if the VR environment is well initialized

// (access to the underlying VR system is effective, VR devices are detected).

if (env.isInitialized()){

VRAppState vrAppState = new VRAppState(settings, env);

vrAppState.setMirrorWindowSize(1024, 800);

Main app = new Main(vrAppState);

app.setLostFocusBehavior(LostFocusBehavior.Disabled);

app.setSettings(settings);

app.setShowSettings(false);

app.start();

}

}

The output is :

run:

May 22, 2019 3:20:44 AM com.jme3.input.vr.openvr.OpenVR initialize

SEVERE: OpenVR Initialize Result: Hmd Not Found (108)

May 22, 2019 3:20:44 AM com.jme3.input.vr.openvr.OpenVR initialize

SEVERE: Initializing OpenVR system [FAILED]

May 22, 2019 3:20:44 AM com.jme3.app.VREnvironment initialize

WARNING: VR native wrapper initialized [FAILED]

May 22, 2019 3:20:44 AM com.jme3.app.VREnvironment initialize

SEVERE: Cannot initialize VR environment [FAILED]

Then I connect ad turn on the head set and run I get the following output:

run:

Exception in thread “main” java.lang.IllegalStateException: Pointer native@0x7ffb02730560 already mapped to Proxy interface to native function@0x7ffb02730560 (com.jme3.system.jopenvr.VR_IVRSystem_FnTable$ComputeDistortion_callback).

Native code may be re-using a default function pointer, in which case you may need to use a common Callback class wherever the function pointer is reused.

at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:148)

at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:131)

at com.sun.jna.Pointer.getValue(Pointer.java:425)

at com.sun.jna.Structure.readField(Structure.java:720)

at com.sun.jna.Structure.read(Structure.java:580)

at com.jme3.input.vr.openvr.OpenVR.initialize(OpenVR.java:202)

at com.jme3.app.VREnvironment.initialize(VREnvironment.java:477)

at mygame.Main.main(Main.java:25)

C:\Users\dbmapit\AppData\Roaming.jmonkeyplatform\v3.2.2-stable-sdk1\var\cache\executor-snippets\run.xml:53: Java returned: 1

BUILD FAILED (total time: 6 seconds)


#102

#103

And if you use this setting?

SETTING_VRAPI_OPENVR_LWJGL_VALUE

The LWJGL implementation uses JNI rather than JNA. (I’m unsure which version it’s available in, or if you use master, so it might be unavailable)


#104

Hello,

Make your tests with settings.put(VRConstants.SETTING_VRAPI, SETTING_VRAPI_OPENVR_LWJGL_VALUE);

In this case you’re avoiding all problems related to JNA, OpenVR version as the VR module will delegate to LWJGL the wrap with the headset.

For more information OPENVR API has to be used with HTC vive headsets and OSVR API has to be used with OCULUS Headsets.


#105

Thank you “seinturier”

I tried settings.put(VRConstants.SETTING_VRAPI, VRConstants.SETTING_VRAPI_OPENVR_LWJGL_VALUE);

and got the following error:

Exception in thread “main” java.lang.IllegalStateException: Pointer native@0x7ffb01360560 already mapped to Proxy interface to native function@0x7ffb01360560 (com.jme3.system.jopenvr.VR_IVRSystem_FnTable$ComputeDistortion_callback).

Native code may be re-using a default function pointer, in which case you may need to use a common Callback class wherever the function pointer is reused.

at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:148)

at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:131)

at com.sun.jna.Pointer.getValue(Pointer.java:425)

at com.sun.jna.Structure.readField(Structure.java:720)

at com.sun.jna.Structure.read(Structure.java:580)

at com.jme3.input.vr.openvr.OpenVR.initialize(OpenVR.java:202)

at com.jme3.app.VREnvironment.initialize(VREnvironment.java:477)

at mygame.Main.main(Main.java:25)

C:\Users\dbmapit\AppData\Roaming.jmonkeyplatform\v3.2.2-stable-sdk1\var\cache\executor-snippets\run.xml:53: Java returned: 1

BUILD FAILED (total time: 1 second)


#106

Try disabling the camera in SteamVR

Edit: It shouldn’t try to initialize OpenVR if VRConstants.SETTING_VRAPI_OPENVR_LWJGL_VALUE is used, rather “OpenVrLwjgl”


Oculus SDK & Quest. VR info in general?
#107

and OSVR API has to be used with OCULUS Headsets.

You should be using OCULUSVR with Oculus headsets?

OSVR is something else entirely.