mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 21:10:12 +02:00
Merge pull request #11122 from ElderOrb/case6760
fix for 6760: Create Mode turns to Portrait when Reopening tablet
This commit is contained in:
commit
f898a05014
1 changed files with 4 additions and 4 deletions
|
@ -42,7 +42,7 @@ var LOCAL_TABLET_MODEL_PATH = Script.resourcesPath() + "meshes/tablet-with-home-
|
||||||
// returns object with two fields:
|
// returns object with two fields:
|
||||||
// * position - position in front of the user
|
// * position - position in front of the user
|
||||||
// * rotation - rotation of entity so it faces the user.
|
// * rotation - rotation of entity so it faces the user.
|
||||||
function calcSpawnInfo(hand, tabletHeight) {
|
function calcSpawnInfo(hand, tabletHeight, landscape) {
|
||||||
var finalPosition;
|
var finalPosition;
|
||||||
|
|
||||||
var headPos = (HMD.active && Camera.mode === "first person") ? HMD.position : Camera.position;
|
var headPos = (HMD.active && Camera.mode === "first person") ? HMD.position : Camera.position;
|
||||||
|
@ -81,7 +81,7 @@ function calcSpawnInfo(hand, tabletHeight) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
position: position,
|
position: position,
|
||||||
rotation: rotation
|
rotation: landscape ? Quat.multiply(rotation, { x: 0.0, y: 0.0, z: 0.707, w: 0.707 }) : rotation
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
var forward = Quat.getForward(headRot);
|
var forward = Quat.getForward(headRot);
|
||||||
|
@ -89,7 +89,7 @@ function calcSpawnInfo(hand, tabletHeight) {
|
||||||
var orientation = Quat.lookAt({x: 0, y: 0, z: 0}, forward, {x: 0, y: 1, z: 0});
|
var orientation = Quat.lookAt({x: 0, y: 0, z: 0}, forward, {x: 0, y: 1, z: 0});
|
||||||
return {
|
return {
|
||||||
position: finalPosition,
|
position: finalPosition,
|
||||||
rotation: Quat.multiply(orientation, {x: 0, y: 1, z: 0, w: 0})
|
rotation: landscape ? Quat.multiply(orientation, ROT_LANDSCAPE) : Quat.multiply(orientation, ROT_Y_180)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ WebTablet.prototype.calculateTabletAttachmentProperties = function (hand, useMou
|
||||||
tabletProperties.parentJointIndex = SENSOR_TO_ROOM_MATRIX;
|
tabletProperties.parentJointIndex = SENSOR_TO_ROOM_MATRIX;
|
||||||
|
|
||||||
// compute the appropriate position of the tablet, near the hand controller that was used to spawn it.
|
// compute the appropriate position of the tablet, near the hand controller that was used to spawn it.
|
||||||
var spawnInfo = calcSpawnInfo(hand, this.height);
|
var spawnInfo = calcSpawnInfo(hand, this.height, this.landscape);
|
||||||
tabletProperties.position = spawnInfo.position;
|
tabletProperties.position = spawnInfo.position;
|
||||||
tabletProperties.rotation = spawnInfo.rotation;
|
tabletProperties.rotation = spawnInfo.rotation;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue