lasers on webpage work again

This commit is contained in:
Seth Alves 2017-01-05 14:35:02 -08:00
parent 5e9c37777c
commit 195b92d05d

View file

@ -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;