mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:16:51 +02:00
fix tablet rotation when switching into and out of create mode
This commit is contained in:
parent
2a8101a944
commit
e14f46101b
1 changed files with 4 additions and 3 deletions
|
@ -47,7 +47,7 @@ function calcSpawnInfo(hand, landscape) {
|
||||||
var headPos = (HMD.active && Camera.mode === "first person") ? HMD.position : Camera.position;
|
var headPos = (HMD.active && Camera.mode === "first person") ? HMD.position : Camera.position;
|
||||||
var headRot = (HMD.active && Camera.mode === "first person") ? HMD.orientation : Camera.orientation;
|
var headRot = (HMD.active && Camera.mode === "first person") ? HMD.orientation : Camera.orientation;
|
||||||
|
|
||||||
var forward = Quat.getForward(headRot);
|
var forward = Quat.getForward(Quat.cancelOutRollAndPitch(headRot));
|
||||||
var FORWARD_OFFSET = 0.5 * MyAvatar.sensorToWorldScale;
|
var FORWARD_OFFSET = 0.5 * MyAvatar.sensorToWorldScale;
|
||||||
finalPosition = Vec3.sum(headPos, Vec3.multiply(FORWARD_OFFSET, forward));
|
finalPosition = Vec3.sum(headPos, Vec3.multiply(FORWARD_OFFSET, forward));
|
||||||
var orientation = Quat.lookAt({x: 0, y: 0, z: 0}, forward, Vec3.multiplyQbyV(MyAvatar.orientation, Vec3.UNIT_Y));
|
var orientation = Quat.lookAt({x: 0, y: 0, z: 0}, forward, Vec3.multiplyQbyV(MyAvatar.orientation, Vec3.UNIT_Y));
|
||||||
|
@ -269,8 +269,9 @@ WebTablet.prototype.setLandscape = function(newLandscapeValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.landscape = newLandscapeValue;
|
this.landscape = newLandscapeValue;
|
||||||
|
var cameraOrientation = Quat.cancelOutRollAndPitch(Camera.orientation);
|
||||||
Overlays.editOverlay(this.tabletEntityID,
|
Overlays.editOverlay(this.tabletEntityID,
|
||||||
{ rotation: Quat.multiply(Camera.orientation, this.landscape ? ROT_LANDSCAPE : ROT_Y_180) });
|
{ rotation: Quat.multiply(cameraOrientation, this.landscape ? ROT_LANDSCAPE : ROT_Y_180) });
|
||||||
|
|
||||||
var tabletWidth = getTabletWidthFromSettings() * MyAvatar.sensorToWorldScale;
|
var tabletWidth = getTabletWidthFromSettings() * MyAvatar.sensorToWorldScale;
|
||||||
var tabletScaleFactor = tabletWidth / TABLET_NATURAL_DIMENSIONS.x;
|
var tabletScaleFactor = tabletWidth / TABLET_NATURAL_DIMENSIONS.x;
|
||||||
|
@ -278,7 +279,7 @@ WebTablet.prototype.setLandscape = function(newLandscapeValue) {
|
||||||
var screenWidth = 0.82 * tabletWidth;
|
var screenWidth = 0.82 * tabletWidth;
|
||||||
var screenHeight = 0.81 * tabletHeight;
|
var screenHeight = 0.81 * tabletHeight;
|
||||||
Overlays.editOverlay(this.webOverlayID, {
|
Overlays.editOverlay(this.webOverlayID, {
|
||||||
rotation: Quat.multiply(Camera.orientation, ROT_LANDSCAPE_WINDOW),
|
rotation: Quat.multiply(cameraOrientation, ROT_LANDSCAPE_WINDOW),
|
||||||
dimensions: {x: this.landscape ? screenHeight : screenWidth, y: this.landscape ? screenWidth : screenHeight, z: 0.1}
|
dimensions: {x: this.landscape ? screenHeight : screenWidth, y: this.landscape ? screenWidth : screenHeight, z: 0.1}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue