Search in sources :

Example 1 with VRControllerState_t

use of com.jme3.system.jopenvr.VRControllerState_t in project jmonkeyengine by jMonkeyEngine.

the class OpenVRInput method getAxisRaw.

@Override
public Vector2f getAxisRaw(int controllerIndex, VRInputType forAxis) {
    VRControllerState_t cs = cStates[OpenVRInput.controllerIndex[controllerIndex]];
    switch(forAxis) {
        default:
            return null;
        case ViveTriggerAxis:
            tempAxis.x = cs.rAxis[1].x;
            tempAxis.y = tempAxis.x;
            break;
        case ViveTrackpadAxis:
            tempAxis.x = cs.rAxis[0].x;
            tempAxis.y = cs.rAxis[0].y;
            break;
    }
    return tempAxis;
}
Also used : VRControllerState_t(com.jme3.system.jopenvr.VRControllerState_t)

Example 2 with VRControllerState_t

use of com.jme3.system.jopenvr.VRControllerState_t in project jmonkeyengine by jMonkeyEngine.

the class OpenVRInput method init.

@Override
public boolean init() {
    logger.config("Initialize OpenVR input.");
    for (int i = 0; i < JOpenVRLibrary.k_unMaxTrackedDeviceCount; i++) {
        rotStore[i] = new Quaternion();
        posStore[i] = new Vector3f();
        cStates[i] = new VRControllerState_t();
        cStates[i].setAutoSynch(false);
        cStates[i].setAutoRead(false);
        cStates[i].setAutoWrite(false);
        lastCallAxis[i] = new Vector2f();
        needsNewVelocity[i] = true;
        needsNewAngVelocity[i] = true;
        logger.config("  Input " + (i + 1) + "/" + JOpenVRLibrary.k_unMaxTrackedDeviceCount + " binded.");
    }
    return true;
}
Also used : Quaternion(com.jme3.math.Quaternion) Vector2f(com.jme3.math.Vector2f) Vector3f(com.jme3.math.Vector3f) VRControllerState_t(com.jme3.system.jopenvr.VRControllerState_t)

Example 3 with VRControllerState_t

use of com.jme3.system.jopenvr.VRControllerState_t in project jmonkeyengine by jMonkeyEngine.

the class OpenVRInput method getAxis.

@Override
public Vector2f getAxis(int controllerIndex, VRInputType forAxis) {
    VRControllerState_t cs = cStates[OpenVRInput.controllerIndex[controllerIndex]];
    switch(forAxis) {
        default:
            return null;
        case ViveTriggerAxis:
            tempAxis.x = cs.rAxis[1].x;
            tempAxis.y = tempAxis.x;
            break;
        case ViveTrackpadAxis:
            tempAxis.x = cs.rAxis[0].x;
            tempAxis.y = cs.rAxis[0].y;
            break;
    }
    tempAxis.x *= axisMultiplier;
    tempAxis.y *= axisMultiplier;
    return tempAxis;
}
Also used : VRControllerState_t(com.jme3.system.jopenvr.VRControllerState_t)

Aggregations

VRControllerState_t (com.jme3.system.jopenvr.VRControllerState_t)3 Quaternion (com.jme3.math.Quaternion)1 Vector2f (com.jme3.math.Vector2f)1 Vector3f (com.jme3.math.Vector3f)1