/** * Position the GUI to the given location. * @param pos the position of the GUI. * @param dir the rotation of the GUI. * @param tpf the time per frame. */ private void positionTo(Vector3f pos, Quaternion dir, float tpf) { if (environment != null){ Vector3f guiPos = guiQuadNode.getLocalTranslation(); guiPos.set(0f, 0f, guiDistance); dir.mult(guiPos, guiPos); guiPos.x += pos.x; guiPos.y += pos.y + environment.getVRHeightAdjustment(); guiPos.z += pos.z; if( guiPositioningElastic > 0f && posMode != VRGUIPositioningMode.MANUAL ) { // mix pos & dir with current pos & dir guiPos.interpolateLocal(EoldPos, guiPos, Float.min(1f, tpf * guiPositioningElastic)); EoldPos.set(guiPos); } } else { throw new IllegalStateException("VR GUI manager is not attached to any environment."); } }