/** * Get the scene observer. If no observer has been set, this method return the application {@link #getCamera() camera}. * @return the scene observer. * @see #setObserver(Spatial) */ public Object getObserver() { return environment.getObserver(); }
/** * Get the observer final rotation within the scene. * @return the observer final rotation within the scene. * @see #getFinalObserverPosition() */ public Quaternion getFinalObserverRotation() { if( environment.getVRViewManager() == null ) { if( environment.getObserver() == null ) { return environment.getCamera().getRotation(); } else { return ((Spatial)environment.getObserver()).getWorldRotation(); } } if( environment.getObserver() == null ) { tempq.set(environment.getDummyCamera().getRotation()); } else { tempq.set(((Spatial)environment.getObserver()).getWorldRotation()); } return tempq.multLocal(environment.getVRHardware().getOrientation()); }
/** * Get the observer final position within the scene. * @return the observer position. * @see #getFinalObserverRotation() */ public Vector3f getFinalObserverPosition() { if( environment.getVRViewManager() == null ) { if( environment.getObserver() == null ) { return environment.getCamera().getLocation(); } else{ return ((Spatial)environment.getObserver()).getWorldTranslation(); } } Vector3f pos = environment.getVRHardware().getPosition(); if( environment.getObserver() == null ) { environment.getDummyCamera().getRotation().mult(pos, pos); return pos.addLocal(environment.getDummyCamera().getLocation()); } else { ((Spatial)environment.getObserver()).getWorldRotation().mult(pos, pos); return pos.addLocal(((Spatial)environment.getObserver()).getWorldTranslation()); } }
@Override public Quaternion getFinalObserverRotation(int index) { if (environment != null) { VRViewManager vrvm = environment.getVRViewManager(); if (vrvm != null) { if (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)); } else { throw new IllegalStateException("VR environment has no valid view manager."); } } else { throw new IllegalStateException("VR input is not attached to a VR environment."); } }
@Override public Quaternion getFinalObserverRotation(int index) { if (environment != null){ OpenVRViewManager vrvm = (OpenVRViewManager)environment.getVRViewManager(); if (vrvm != null){ if(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)); } else { throw new IllegalStateException("VR environment has no valid view manager."); } } else { throw new IllegalStateException("VR input is not attached to a VR environment."); } }
@Override public void update(float tpf) { // update VR pose & cameras if( environment.getVRViewManager() != null ) { environment.getVRViewManager().update(tpf); } else if( environment.getObserver() != null ) { environment.getCamera().setFrame(((Spatial)environment.getObserver()).getWorldTranslation(), ((Spatial)environment.getObserver()).getWorldRotation()); } if( environment.isInVR() == false || environment.getVRGUIManager().getPositioningMode() == VRGUIPositioningMode.MANUAL ) { // only update geometric state here if GUI is in manual mode, or not in VR // it will get updated automatically in the viewmanager update otherwise // TODO isn't this done by SimpleApplication? for (Spatial spatial : application.getGuiViewPort().getScenes()) { //spatial.updateLogicalState(tpf); spatial.updateGeometricState(); } } // use the analog control on the first tracked controller to push around the mouse environment.getVRMouseManager().updateAnalogAsMouse(0, null, null, null, tpf); }
@Override public Quaternion getFinalObserverRotation(int index) { OSVRViewManager vrvm = (OSVRViewManager)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)); }
@Override public Vector3f getFinalObserverPosition(int index) { if (environment != null) { VRViewManager vrvm = (VRViewManager) environment.getVRViewManager(); if (vrvm != null) { if (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()); } } else { throw new IllegalStateException("VR environment has no valid view manager."); } } else { throw new IllegalStateException("VR input is not attached to a VR environment."); } }
@Override public Vector3f getFinalObserverPosition(int index) { if (environment != null){ OpenVRViewManager vrvm = (OpenVRViewManager)environment.getVRViewManager(); if (vrvm != null){ if(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()); } } else { throw new IllegalStateException("VR environment has no valid view manager."); } } else { throw new IllegalStateException("VR input is not attached to a VR environment."); } }
@Override public Quaternion getFinalObserverRotation(int index) { // Copied from OpenVRInput VREnvironment env = hardware.getEnvironment(); OculusViewManager vrvm = (OculusViewManager) hardware.getEnvironment().getVRViewManager(); Object obs = env.getObserver(); Quaternion tempq = new Quaternion(); // TODO move to class scope? if (obs instanceof Camera) { tempq.set(((Camera) obs).getRotation()); } else { tempq.set(((Spatial) obs).getWorldRotation()); } return tempq.multLocal(getOrientation(index)); }
@Override public Vector3f getFinalObserverPosition(int index) { OSVRViewManager vrvm = (OSVRViewManager) 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()); } }
@Override public Vector3f getFinalObserverPosition(int index) { // Copied from OpenVRInput VREnvironment env = hardware.getEnvironment(); OculusViewManager vrvm = (OculusViewManager) hardware.getEnvironment().getVRViewManager(); Object obs = env.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()); } }
Object obs = environment.getObserver(); if( obs != null ) { if( obs instanceof Camera ) { case AUTO_OBSERVER_ALL: case AUTO_OBSERVER_ALL_CAMHEIGHT: obs = environment.getObserver(); if( obs != null ) { Quaternion q;
Object obs = environment.getObserver(); Quaternion objRot; Vector3f objPos;
Object obs = environment.getObserver(); Quaternion objRot; Vector3f objPos;
if (environment != null) { Object obs = environment.getObserver(); Quaternion objRot; Vector3f objPos;
Object obs = environment.getObserver(); Quaternion objRot; Vector3f objPos;