use of com.jme3.util.VRViewManagerOSVR in project jmonkeyengine by jMonkeyEngine.
the class OSVRInput method getFinalObserverPosition.
@Override
public Vector3f getFinalObserverPosition(int index) {
VRViewManagerOSVR vrvm = (VRViewManagerOSVR) environment.getVRViewManager();
if (vrvm == null || isInputDeviceTracking(index) == false)
return null;
Object obs = environment.getObserver();
Vector3f pos = getPosition(index);
if (obs instanceof Camera) {
((Camera) obs).getRotation().mult(pos, pos);
return pos.addLocal(((Camera) obs).getLocation());
} else {
((Spatial) obs).getWorldRotation().mult(pos, pos);
return pos.addLocal(((Spatial) obs).getWorldTranslation());
}
}
use of com.jme3.util.VRViewManagerOSVR in project jmonkeyengine by jMonkeyEngine.
the class VREnvironment method atttach.
/**
* Attach the VR environment to the given app state and application.
* This method should be called within the {@link AppState#stateAttached(com.jme3.app.state.AppStateManager) stateAttached(com.jme3.app.state.AppStateManager)} method
* from the app state.
* @param appState the app state to attach.
* @param application the application to attach.
*/
public void atttach(AppState appState, Application application) {
this.application = application;
this.app = appState;
// Instanciate view manager
if (vrBinding == VRConstants.SETTING_VRAPI_OPENVR_VALUE) {
viewmanager = new VRViewManagerOpenVR(this);
} else if (vrBinding == VRConstants.SETTING_VRAPI_OSVR_VALUE) {
viewmanager = new VRViewManagerOSVR(this);
} else {
logger.severe("Cannot instanciate view manager, unknown VRAPI type: " + vrBinding);
}
}
use of com.jme3.util.VRViewManagerOSVR in project jmonkeyengine by jMonkeyEngine.
the class OSVRInput method getFinalObserverRotation.
@Override
public Quaternion getFinalObserverRotation(int index) {
VRViewManagerOSVR vrvm = (VRViewManagerOSVR) environment.getVRViewManager();
if (vrvm == null || isInputDeviceTracking(index) == false)
return null;
Object obs = environment.getObserver();
if (obs instanceof Camera) {
tempq.set(((Camera) obs).getRotation());
} else {
tempq.set(((Spatial) obs).getWorldRotation());
}
return tempq.multLocal(getOrientation(index));
}
Aggregations