mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:14:34 +02:00
Disable grabbing the mini tablet with the grip button
This commit is contained in:
parent
0ae7fdc7b1
commit
eac1666e01
2 changed files with 29 additions and 2 deletions
|
@ -500,7 +500,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("WARNING: handControllerGrab.js -- error parsing Hifi-Hand-RayPick-Blacklist message: " + message);
|
print("WARNING: handControllerGrab.js -- error parsing message: " + data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
this.previousParentJointIndex = {};
|
this.previousParentJointIndex = {};
|
||||||
this.previouslyUnhooked = {};
|
this.previouslyUnhooked = {};
|
||||||
this.robbed = false;
|
this.robbed = false;
|
||||||
|
this.miniTabletID = null;
|
||||||
|
|
||||||
this.parameters = makeDispatcherModuleParameters(
|
this.parameters = makeDispatcherModuleParameters(
|
||||||
90,
|
90,
|
||||||
|
@ -42,6 +43,10 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
return (this.hand === RIGHT_HAND) ? leftNearParentingGrabOverlay : rightNearParentingGrabOverlay;
|
return (this.hand === RIGHT_HAND) ? leftNearParentingGrabOverlay : rightNearParentingGrabOverlay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.setMiniTabletID = function (id) {
|
||||||
|
this.miniTabletID = id;
|
||||||
|
}
|
||||||
|
|
||||||
this.otherHandIsParent = function(props) {
|
this.otherHandIsParent = function(props) {
|
||||||
return this.getOtherModule().thisHandIsParent(props);
|
return this.getOtherModule().thisHandIsParent(props);
|
||||||
};
|
};
|
||||||
|
@ -163,7 +168,10 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
var handPosition = controllerData.controllerLocations[this.hand].position;
|
var handPosition = controllerData.controllerLocations[this.hand].position;
|
||||||
var distance = Vec3.distance(overlayPosition, handPosition);
|
var distance = Vec3.distance(overlayPosition, handPosition);
|
||||||
if (distance <= NEAR_GRAB_RADIUS * sensorScaleFactor) {
|
if (distance <= NEAR_GRAB_RADIUS * sensorScaleFactor) {
|
||||||
return overlays[i];
|
if (overlays[i] !== this.miniTabletID || controllerData.secondaryValues[this.hand] === 0) {
|
||||||
|
// Don't grab mini tablet with grip.
|
||||||
|
return overlays[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -217,6 +225,25 @@ Script.include("/~/system/libraries/utils.js");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleMessage(channel, data, sender) {
|
||||||
|
if (sender !== MyAvatar.sessionUUID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channel === 'Hifi-MiniTablet-Details') {
|
||||||
|
try {
|
||||||
|
var message = JSON.parse(data);
|
||||||
|
leftNearParentingGrabOverlay.setMiniTabletID(message.overlay);
|
||||||
|
rightNearParentingGrabOverlay.setMiniTabletID(message.overlay);
|
||||||
|
} catch (e) {
|
||||||
|
print("WARNING: nearParentGrabOverlay.js -- error parsing message: " + data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Messages.subscribe('Hifi-MiniTablet-Details');
|
||||||
|
Messages.messageReceived.connect(handleMessage);
|
||||||
|
|
||||||
var leftNearParentingGrabOverlay = new NearParentingGrabOverlay(LEFT_HAND);
|
var leftNearParentingGrabOverlay = new NearParentingGrabOverlay(LEFT_HAND);
|
||||||
var rightNearParentingGrabOverlay = new NearParentingGrabOverlay(RIGHT_HAND);
|
var rightNearParentingGrabOverlay = new NearParentingGrabOverlay(RIGHT_HAND);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue