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

@ -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
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 > 0 && _this.state == STATE_HOLD) {
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;
}
}