one hand teleprt

This commit is contained in:
James B. Pollack 2016-08-02 12:52:35 -07:00
parent 7fae7e9c77
commit 41aa485f11
2 changed files with 27 additions and 9 deletions

View file

@ -1378,7 +1378,7 @@ function MyController(hand) {
}; };
this.distanceHoldingEnter = function() { this.distanceHoldingEnter = function() {
Messages.sendLocalMessage('Hifi-Teleport-Disabler','disable'); Messages.sendLocalMessage('Hifi-Teleport-Disabler','both');
this.clearEquipHaptics(); this.clearEquipHaptics();
// controller pose is in avatar frame // controller pose is in avatar frame
@ -1636,8 +1636,14 @@ function MyController(hand) {
}; };
this.nearGrabbingEnter = function() { this.nearGrabbingEnter = function() {
Messages.sendLocalMessage('Hifi-Teleport-Disabler','disable'); if (this.hand === 0) {
Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'left');
}
if (this.hand === 1) {
Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'right');
}
this.lineOff(); this.lineOff();
this.overlayLineOff(); this.overlayLineOff();
@ -1964,7 +1970,7 @@ function MyController(hand) {
}; };
this.release = function() { this.release = function() {
Messages.sendLocalMessage('Hifi-Teleport-Disabler','enable'); Messages.sendLocalMessage('Hifi-Teleport-Disabler','none');
this.turnOffVisualizations(); this.turnOffVisualizations();
var noVelocity = false; var noVelocity = false;

View file

@ -239,11 +239,14 @@ function Teleporter() {
this.update = function() { this.update = function() {
if (isDisabled) { if (isDisabled === 'both') {
return; return;
} }
if (teleporter.teleportHand === 'left') { if (teleporter.teleportHand === 'left') {
if (isDisabled === 'left') {
return;
}
teleporter.leftRay(); teleporter.leftRay();
//|| leftTrigger.buttonValue === 0 //|| leftTrigger.buttonValue === 0
if ((leftPad.buttonValue === 0) && inTeleportMode === true) { if ((leftPad.buttonValue === 0) && inTeleportMode === true) {
@ -252,6 +255,9 @@ function Teleporter() {
} }
} else { } else {
if (isDisabled === 'right') {
return;
}
teleporter.rightRay(); teleporter.rightRay();
//|| rightTrigger.buttonValue === 0 //|| rightTrigger.buttonValue === 0
if ((rightPad.buttonValue === 0) && inTeleportMode === true) { if ((rightPad.buttonValue === 0) && inTeleportMode === true) {
@ -588,7 +594,7 @@ function registerMappings() {
teleportMapping.from(Controller.Standard.LeftPrimaryThumb) teleportMapping.from(Controller.Standard.LeftPrimaryThumb)
// .when(leftTrigger.down) // .when(leftTrigger.down)
.to(function(value) { .to(function(value) {
if (isDisabled === true) { if (isDisabled === 'left' || isDisabled === 'both') {
return; return;
} }
if (activationTimeout !== null) { if (activationTimeout !== null) {
@ -604,7 +610,7 @@ function registerMappings() {
teleportMapping.from(Controller.Standard.RightPrimaryThumb) teleportMapping.from(Controller.Standard.RightPrimaryThumb)
// .when(rightTrigger.down) // .when(rightTrigger.down)
.to(function(value) { .to(function(value) {
if (isDisabled === true) { if (isDisabled === 'right' || isDisabled === 'both') {
return; return;
} }
if (activationTimeout !== null) { if (activationTimeout !== null) {
@ -669,10 +675,16 @@ var handleHandMessages = function(channel, message, sender) {
var data; var data;
if (sender === MyAvatar.sessionUUID) { if (sender === MyAvatar.sessionUUID) {
if (channel === 'Hifi-Teleport-Disabler') { if (channel === 'Hifi-Teleport-Disabler') {
if (message === 'disable') { if (message === 'both') {
isDisabled = true; isDisabled = 'both';
} }
if (message === 'enable') { if (message === 'left') {
isDisabled = 'left';
}
if (message === 'right') {
isDisabled = 'right'
}
if (message === 'none') {
isDisabled = false; isDisabled = false;
} }