From 42fd964a2262d3633c4f52aef292c69eac3dcc8e Mon Sep 17 00:00:00 2001 From: Campbell Suter Date: Sat, 7 Oct 2017 22:36:32 +1300 Subject: [PATCH] Un-break VR mouse support for OpenVR --- jme3-vr/src/main/java/com/jme3/app/VRAppState.java | 6 +++++- jme3-vr/src/main/java/com/jme3/util/VRMouseManager.java | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/jme3-vr/src/main/java/com/jme3/app/VRAppState.java b/jme3-vr/src/main/java/com/jme3/app/VRAppState.java index 6d29dbb24..7dbf7af41 100644 --- a/jme3-vr/src/main/java/com/jme3/app/VRAppState.java +++ b/jme3-vr/src/main/java/com/jme3/app/VRAppState.java @@ -35,6 +35,7 @@ import com.jme3.app.Application; import com.jme3.app.state.AbstractAppState; import com.jme3.app.state.AppStateManager; import com.jme3.input.vr.OculusVR; +import com.jme3.input.vr.OpenVR; import com.jme3.input.vr.VRAPI; import com.jme3.input.vr.VRInputAPI; import com.jme3.math.ColorRGBA; @@ -420,7 +421,10 @@ public class VRAppState extends AbstractAppState { } // use the analog control on the first tracked controller to push around the mouse - // environment.getVRMouseManager().updateAnalogAsMouse(0, null, null, null, tpf); + // FIXME crashes on Rift/Touch (and probably OSVR), as it assumes the presence of the Vive touchpads + if(getVRHardware() instanceof OpenVR) { + environment.getVRMouseManager().updateAnalogAsMouse(0, null, null, null, tpf); + } } @Override diff --git a/jme3-vr/src/main/java/com/jme3/util/VRMouseManager.java b/jme3-vr/src/main/java/com/jme3/util/VRMouseManager.java index 32eaca069..164ea12e6 100644 --- a/jme3-vr/src/main/java/com/jme3/util/VRMouseManager.java +++ b/jme3-vr/src/main/java/com/jme3/util/VRMouseManager.java @@ -182,6 +182,7 @@ public class VRMouseManager { } Vector2f tpDelta; + // TODO option to use Touch joysticks if( thumbstickMode ) { tpDelta = environment.getVRinput().getAxis(inputIndex, VRInputType.ViveTrackpadAxis); } else {