Merge pull request #8684 from Menithal/controller-grab-unequip

Fixed HandcontrollerGrab distance unequip
This commit is contained in:
Seth Alves 2016-10-19 09:53:04 -07:00 committed by GitHub
commit 7e4964db3e

View file

@ -2091,12 +2091,12 @@ function MyController(hand) {
var TEAR_AWAY_DISTANCE = 0.1; var TEAR_AWAY_DISTANCE = 0.1;
var dist = distanceBetweenPointAndEntityBoundingBox(handPosition, props); var dist = distanceBetweenPointAndEntityBoundingBox(handPosition, props);
if (dist > TEAR_AWAY_DISTANCE) { if (dist > TEAR_AWAY_DISTANCE) {
this.autoUnequipCounter += 1; this.autoUnequipCounter += deltaTime;
} else { } else {
this.autoUnequipCounter = 0; this.autoUnequipCounter = 0;
} }
if (this.autoUnequipCounter > 1) { if (this.autoUnequipCounter > 0.25) {
// for whatever reason, the held/equipped entity has been pulled away. ungrab or unequip. // for whatever reason, the held/equipped entity has been pulled away. ungrab or unequip.
print("handControllerGrab -- autoreleasing held or equipped item because it is far from hand." + print("handControllerGrab -- autoreleasing held or equipped item because it is far from hand." +
props.parentID + ", dist = " + dist); props.parentID + ", dist = " + dist);