mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 01:46:23 +02:00
make a version of computePick that works off of view frustum even when in HMD mode, updates to lobby
This commit is contained in:
parent
310e31377d
commit
efe202b7e8
3 changed files with 19 additions and 9 deletions
|
@ -329,7 +329,9 @@ function handleLookAt(pickRay) {
|
|||
}
|
||||
}
|
||||
formatedDescription += currentGoodLine;
|
||||
Overlays.editOverlay(descriptionText, { text: formatedDescription });
|
||||
Overlays.editOverlay(descriptionText, { text: formatedDescription, visible: true });
|
||||
} else {
|
||||
Overlays.editOverlay(descriptionText, { text: "", visible: false });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -348,8 +350,7 @@ function update(deltaTime) {
|
|||
var nowDate = new Date();
|
||||
var now = nowDate.getTime();
|
||||
if (now - lastMouseMove > IDLE_HOVER_TIME) {
|
||||
var windowDimensions = Controller.getViewportDimensions();
|
||||
var pickRay = Camera.computePickRay(windowDimensions.x / 2, windowDimensions.y / 2);
|
||||
var pickRay = Camera.computeViewPickRay(0.5, 0.5);
|
||||
handleLookAt(pickRay);
|
||||
}
|
||||
|
||||
|
@ -363,14 +364,16 @@ function update(deltaTime) {
|
|||
}
|
||||
|
||||
function mouseMoveEvent(event) {
|
||||
var nowDate = new Date();
|
||||
lastMouseMove = nowDate.getTime();
|
||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||
handleLookAt(pickRay);
|
||||
if (panelWall) {
|
||||
var nowDate = new Date();
|
||||
lastMouseMove = nowDate.getTime();
|
||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||
handleLookAt(pickRay);
|
||||
}
|
||||
}
|
||||
|
||||
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
||||
Controller.actionStartEvent.connect(actionStartEvent);
|
||||
Controller.backStartEvent.connect(backStartEvent);
|
||||
Script.update.connect(update);
|
||||
Script.scriptEnding.connect(maybeCleanupLobby);
|
||||
Script.scriptEnding.connect(maybeCleanupLobby);
|
||||
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
||||
|
|
|
@ -108,6 +108,12 @@ PickRay Camera::computePickRay(float x, float y) {
|
|||
return result;
|
||||
}
|
||||
|
||||
PickRay Camera::computeViewPickRay(float xRatio, float yRatio) {
|
||||
PickRay result;
|
||||
Application::getInstance()->getViewFrustum()->computePickRay(xRatio, yRatio, result.origin, result.direction);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Camera::setModeString(const QString& mode) {
|
||||
CameraMode targetMode = stringToMode(mode);
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ public slots:
|
|||
glm::quat getOrientation() const { return getRotation(); }
|
||||
|
||||
PickRay computePickRay(float x, float y);
|
||||
PickRay computeViewPickRay(float xRatio, float yRatio);
|
||||
signals:
|
||||
void modeUpdated(const QString& newMode);
|
||||
|
||||
|
|
Loading…
Reference in a new issue