Official VR module


Since 3.2.0 actually 3.3.0 has not been released yet


I can confirm. I was able to run the sample code provided for VR.


Has the vr module been tested with any Microsoft Mixed Reality headsets yet?


Sorry if this isn’t a good place to post this. I don’t see a forum for VR.

I’m trying to get the VRAppStateSample working. I have a Windows 10 desktop on which I’ve been playing games with Oculus Rift, so I have SteamVR and hardware-specific stuff working.

I’ve tried adding jME to my own NetBeans IDL and I’ve tried the jME SDK.

I’ve tried the jME3.2_stable distribution (doesn’t have jme3-vr) and I’ve built the libraries from GitHub (although I don’t understand the different between what’s built in build/libDist/lib and dist/lib).

I’m using Java 8.

The error I get in building is
Compiling 1 source file to C:\Users\sitongial\src\NetBeansProjects\VRSample\build\classes
C:\Users\sitongial\src\NetBeansProjects\VRSample\src\sample\ error: cannot access Callback
class file for com.sun.jna.Callback not found
1 error
C:\Users\sitongial\src\NetBeansProjects\VRSample\nbproject\build-impl.xml:930: The following error occurred while executing this line:
C:\Users\sitongial\src\NetBeansProjects\VRSample\nbproject\build-impl.xml:270: Compile failed; see the compiler error output for details.

Thank you.



jME 3.2 has the jme3-vr module it’s even the first stable version that implements VR.
form the error you are getting it looks like the jme3-vr module is missing can you check in the file called build.gradle or build.xml if the jme3-vr is included.

that’s why we have an uncategorized category.


I’ll restart this thread in uncategorized.


I’m back because it does seem, after all, that this is the right place…

The runtime error is a null pointer at VREnvironment:496. getVRGUIManager is null because it isn’t instantiated until the next line in the VR Sample:


VREnvironment environment = new VREnvironment(settings);



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.


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.


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…


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


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;


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:


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.


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(
at com.sun.jna.CallbackReference.getCallback(
at com.sun.jna.Pointer.getValue(
at com.sun.jna.Structure.readField(
at com.jme3.input.vr.openvr.OpenVR.initialize(
at mygame.Main.main(
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?



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)


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.