diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 874e06ca18..2475314873 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -866,7 +866,8 @@ function MyController(hand) { if (WANT_DEBUG || WANT_DEBUG_STATE) { var oldStateName = stateToName(this.state); var newStateName = stateToName(newState); - print("STATE (" + this.hand + "): " + newStateName + " <-- " + oldStateName + ", reason = " + reason); + print("STATE (" + this.hand + "): " + this.state + "-" + newStateName + + " <-- " + oldStateName + ", reason = " + reason); } // exit the old state @@ -1231,7 +1232,7 @@ function MyController(hand) { var nearWeb = false; for (var i = 0; i < candidateEntities.length; i++) { var props = entityPropertiesCache.getProps(candidateEntities[i]); - if (props.type == "Web" || this.isTablet(props)) { + if (props && (props.type == "Web" || this.isTablet(props))) { nearWeb = true; break; } @@ -2740,6 +2741,11 @@ function MyController(hand) { entityPropertiesCache.addEntity(this.grabbedEntity); + if (this.state == STATE_ENTITY_LASER_TOUCHING && !this.triggerSmoothedGrab()) { + this.setState(STATE_OFF, "released trigger"); + return; + } + // test for intersection between controller laser and web entity plane. var intersectInfo = handLaserIntersectEntity(this.grabbedEntity, getControllerWorldLocation(this.handToController(), true)); @@ -2845,6 +2851,11 @@ function MyController(hand) { return; } + if (this.state == STATE_OVERLAY_LASER_TOUCHING && !this.triggerSmoothedGrab()) { + this.setState(STATE_OFF, "released trigger"); + return; + } + // Test for intersection between controller laser and Web overlay plane. var intersectInfo = handLaserIntersectOverlay(this.grabbedOverlay, getControllerWorldLocation(this.handToController(), true)); @@ -3387,11 +3398,13 @@ var updateIntervalTimer = Script.setInterval(function(){ if (intervalCount == 100) { if (UPDATE_PERFORMANCE_DEBUGGING) { - print("handControllerGrab.js -- For " + intervalCount + " samples average= " + totalDelta/intervalCount + " ms" - + " average variance:" + totalVariance/intervalCount + " ms" - + " high variance count:" + highVarianceCount + " [ " + (highVarianceCount/intervalCount) * 100 + "% ] " - + " VERY high variance count:" + veryhighVarianceCount + " [ " + (veryhighVarianceCount/intervalCount) * 100 + "% ] " - + " average work:" + updateTotalWork/intervalCount + " ms"); + print("handControllerGrab.js -- For " + intervalCount + " samples average= " + + totalDelta/intervalCount + " ms" + + " average variance:" + totalVariance/intervalCount + " ms" + + " high variance count:" + highVarianceCount + " [ " + (highVarianceCount/intervalCount) * 100 + "% ] " + + " VERY high variance count:" + veryhighVarianceCount + + " [ " + (veryhighVarianceCount/intervalCount) * 100 + "% ] " + + " average work:" + updateTotalWork/intervalCount + " ms"); } intervalCount = 0;