add special equip for oculus style grab

This commit is contained in:
Stephen Birarda 2016-12-20 14:21:23 -08:00
parent 13e03b35cc
commit 0a024616cc

View file

@ -823,7 +823,7 @@ function MyController(hand) {
if (this.hand === RIGHT_HAND && this.state === STATE_SEARCHING && this.getOtherHandController().state === STATE_SEARCHING) {
this.maybeScaleMyAvatar();
}
if (this.ignoreInput()) {
this.turnOffVisualizations();
return;
@ -1063,11 +1063,16 @@ function MyController(hand) {
this.secondaryPress = function(value) {
_this.rawSecondaryValue = value;
// The value to check if we will allow the release function to be called
var allowReleaseValue = 0.1;
if (value > 0 && _this.state == STATE_HOLD) {
_this.release();
if (_this.state == STATE_HOLD && !this.secondaryHeldEquip) {
// when using the index trigger click equip
// any click on the middle finger trigger should release
// check if the middle finger trigger is pressed past the threshold
var allowReleaseValue = 0.1;
if (value > allowReleaseValue) {
_this.release();
}
}
};
this.updateSmoothedTrigger = function() {
@ -1095,6 +1100,12 @@ function MyController(hand) {
this.secondaryReleased = function() {
return _this.rawSecondaryValue < BUMPER_ON_VALUE;
if (_this.state == STATE_HOLD && this.secondaryHeldEquip) {
// when using the middle finger hold equip, the equip is
// dropped when the middle finger trigger is released
_this.release();
}
};
// this.triggerOrsecondarySqueezed = function () {
@ -1502,6 +1513,10 @@ function MyController(hand) {
this.grabbedHotspot = potentialEquipHotspot;
this.grabbedEntity = potentialEquipHotspot.entityID;
this.setState(STATE_HOLD, "equipping '" + entityPropertiesCache.getProps(this.grabbedEntity).name + "'");
// handle the Oculus Touch equip where the middle finger trigger is held
this.secondaryHeldEquip = this.secondarySqueezed && !this.triggerSmoothedGrab;
return;
}
}