Official VR module


#81

Since 3.2.0 actually 3.3.0 has not been released yet


#82

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


#83

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


#84

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\VRAppStateSample.java:221: error: cannot access Callback
((OpenVR)vrAppState.getVRHardware()).getCompositor().CompositorDumpImages.apply();
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.


#85

@sitongial

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.


#86

I’ll restart this thread in uncategorized.


#87

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:

Blockquote

VREnvironment environment = new VREnvironment(settings);
environment.initialize();


#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.