mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
Merge pull request #9329 from druiz17/tabletPosition
Tablet positioning works for all input devices
This commit is contained in:
commit
4fa4c73f0d
2 changed files with 14 additions and 10 deletions
|
@ -469,6 +469,8 @@ clickMapping.from(Controller.Standard.LeftSecondaryThumb).peek().to(function (cl
|
|||
clickMapping.from(Controller.Standard.Start).peek().to(function (clicked) {
|
||||
if (clicked) {
|
||||
activeHudPoint2dGamePad();
|
||||
var noHands = -1;
|
||||
Messages.sendLocalMessage("toggleHand", noHands);
|
||||
}
|
||||
|
||||
wantsMenu = clicked;
|
||||
|
@ -480,6 +482,8 @@ clickMapping.from(Controller.Hardware.Keyboard.RightMouseClicked).peek().to(func
|
|||
// We don't want the system code to always do this for us, because, e.g., we do not want to get a mouseMove
|
||||
// after the Left/RightSecondaryThumb gives us a context menu. Only from the mouse.
|
||||
Script.setTimeout(function () {
|
||||
var noHands = -1;
|
||||
Messages.sendLocalMessage("toggleHand", noHands);
|
||||
Reticle.setPosition(Reticle.position);
|
||||
}, 0);
|
||||
});
|
||||
|
|
|
@ -22,8 +22,8 @@ var TABLET_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Tablet-Model-v1-
|
|||
// * position - position in front of the user
|
||||
// * rotation - rotation of entity so it faces the user.
|
||||
function calcSpawnInfo(hand) {
|
||||
var pitchBackRotation = Quat.angleAxis(20.0, X_AXIS);
|
||||
if (HMD.active) {
|
||||
var noHands = -1;
|
||||
if (HMD.active && hand != noHands) {
|
||||
var handController = getControllerWorldLocation(hand, false);
|
||||
var front = Quat.getFront(handController.orientation);
|
||||
var up = Quat.getUp(handController.orientation);
|
||||
|
@ -35,9 +35,10 @@ function calcSpawnInfo(hand) {
|
|||
};
|
||||
} else {
|
||||
var front = Quat.getFront(MyAvatar.orientation);
|
||||
var finalPosition = Vec3.sum(Vec3.sum(MyAvatar.position, Vec3.multiply(0.6, front)), {x: 0, y: 0.6, z: 0});
|
||||
return {
|
||||
position: Vec3.sum(Vec3.sum(MyAvatar.position, Vec3.multiply(0.6, front)), {x: 0, y: 0.6, z: 0}),
|
||||
rotation: Quat.multiply(MyAvatar.orientation, pitchBackRotation)
|
||||
position: finalPosition,
|
||||
rotation: Quat.lookAt(finalPosition, MyAvatar.getHeadPosition(), Y_AXIS)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -118,13 +119,13 @@ WebTablet = function (url, width, dpi, hand, clientOnly) {
|
|||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
tablet.gotoHomeScreen();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.state = "idle";
|
||||
|
||||
this.getRoot = function() {
|
||||
return Entities.getWebViewRoot(_this.webEntityID);
|
||||
}
|
||||
};
|
||||
|
||||
this.getLocation = function() {
|
||||
return Entities.getEntityProperties(_this.tabletEntityID, ["localPosition", "localRotation"]);
|
||||
|
@ -157,12 +158,12 @@ WebTablet.prototype.pickle = function () {
|
|||
WebTablet.prototype.register = function() {
|
||||
Messages.subscribe("home");
|
||||
Messages.messageReceived.connect(this.receive);
|
||||
}
|
||||
};
|
||||
|
||||
WebTablet.prototype.unregister = function() {
|
||||
Messages.unsubscribe("home");
|
||||
Messages.messageReceived.disconnect(this.receive);
|
||||
}
|
||||
};
|
||||
|
||||
WebTablet.unpickle = function (string) {
|
||||
if (!string) {
|
||||
|
@ -175,5 +176,4 @@ WebTablet.unpickle = function (string) {
|
|||
|
||||
WebTablet.prototype.getPosition = function () {
|
||||
return Overlays.getProperty(this.webOverlayID, "position");
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue