public Vector3 getValue() { _vector.set(1f, _azimuthPanel.getDoubleValue() * MathUtils.DEG_TO_RAD, _elevationPanel.getDoubleValue() * MathUtils.DEG_TO_RAD); final Vector3 result = new Vector3(); MathUtils.sphericalToCartesian(_vector, result); return result; }
/** * Update the position of the Camera controlled by this object. * * @param time * a delta time, in seconds. Not used currently, but might be useful for doing "ease-in" of camera * movements. */ public void update(final double time) { updateTargetPos(); if (!_dirty) { return; } if (_worldUpVec.getY() == 1) { MathUtils.sphericalToCartesian(_sphereCoords, _camPosition); } else if (_worldUpVec.getZ() == 1) { MathUtils.sphericalToCartesianZ(_sphereCoords, _camPosition); } _camera.setLocation(_camPosition.addLocal(_lookAtPoint)); _camera.lookAt(_lookAtPoint, _worldUpVec); _dirty = false; }
/** * Update the position of the Camera controlled by this object. * * @param time * a delta time, in seconds. Not used currently, but might be useful for doing "ease-in" of camera * movements. */ public void update(final double time) { updateTargetPos(); if (!_dirty) { return; } if (_worldUpVec.getY() == 1) { MathUtils.sphericalToCartesian(_sphereCoords, _camPosition); } else if (_worldUpVec.getZ() == 1) { MathUtils.sphericalToCartesianZ(_sphereCoords, _camPosition); } if (_camera != null) { _camera.setLocation(_camPosition.addLocal(_lookAtPoint)); _camera.lookAt(_lookAtPoint, _worldUpVec); } _dirty = false; }