Rename touch to grab non colliding

This commit is contained in:
James Pollack 2015-09-23 13:20:21 -07:00
parent 9736dee2d7
commit ba44390f79

View file

@ -84,10 +84,11 @@ var STATE_DISTANCE_HOLDING = 1;
var STATE_CONTINUE_DISTANCE_HOLDING = 2; var STATE_CONTINUE_DISTANCE_HOLDING = 2;
var STATE_NEAR_GRABBING = 3; var STATE_NEAR_GRABBING = 3;
var STATE_CONTINUE_NEAR_GRABBING = 4; var STATE_CONTINUE_NEAR_GRABBING = 4;
var STATE_NEAR_TOUCHING = 5; var STATE_NEAR_GRABBING_NON_COLLIDING = 5;
var STATE_CONTINUE_NEAR_TOUCHING = 6; var STATE_CONTINUE_NEAR_GRABBING_NON_COLLIDING = 6;
var STATE_RELEASE = 7; var STATE_RELEASE = 7;
var GRAB_USER_DATA_KEY = "grabKey"; var GRAB_USER_DATA_KEY = "grabKey";
function controller(hand, triggerAction) { function controller(hand, triggerAction) {
@ -127,11 +128,11 @@ function controller(hand, triggerAction) {
case STATE_CONTINUE_NEAR_GRABBING: case STATE_CONTINUE_NEAR_GRABBING:
this.continueNearGrabbing(); this.continueNearGrabbing();
break; break;
case STATE_NEAR_TOUCHING: case STATE_NEAR_GRABBING_NON_COLLIDING:
this.nearTouching(); this.nearGrabbingNonColliding();
break; break;
case STATE_CONTINUE_NEAR_TOUCHING: case STATE_CONTINUE_NEAR_GRABBING_NON_COLLIDING:
this.continueNearTouching(); this.continueNearGrabbingNonColliding();
break; break;
case STATE_RELEASE: case STATE_RELEASE:
this.release(); this.release();
@ -233,8 +234,8 @@ function controller(hand, triggerAction) {
} else if (props.locked === 0 && props.collisionsWillMove === 1) { } else if (props.locked === 0 && props.collisionsWillMove === 1) {
this.state = STATE_NEAR_GRABBING; this.state = STATE_NEAR_GRABBING;
} else if (props.collisionsWillMove === 0) { } else if (props.collisionsWillMove === 0) {
// We have grabbed a non-physical object, so we want to trigger a touch event as opposed to a grab event // We have grabbed a non-physical object, so we want to trigger a non-colliding event as opposed to a grab event
this.state = STATE_NEAR_TOUCHING; this.state = STATE_NEAR_GRABBING_NON_COLLIDING;
} }
} }
} }
@ -369,21 +370,21 @@ function controller(hand, triggerAction) {
this.currentObjectTime = Date.now(); this.currentObjectTime = Date.now();
} }
this.nearTouching = function() { this.nearGrabbingNonColliding = function() {
if (!this.triggerSmoothedSqueezed()) { if (!this.triggerSmoothedSqueezed()) {
this.state = STATE_RELEASE; this.state = STATE_RELEASE;
return; return;
} }
Entities.callEntityMethod(this.grabbedEntity, "startNearTouch") Entities.callEntityMethod(this.grabbedEntity, "startNearGrabNonColliding")
this.state = STATE_CONTINUE_NEAR_TOUCHING; this.state = STATE_CONTINUE_NEAR_GRABBING_NON_COLLIDING;
} }
this.continueNearTouching = function() { this.continueNearGrabNonColliding = function() {
if (!this.triggerSmoothedSqueezed()) { if (!this.triggerSmoothedSqueezed()) {
this.state = STATE_RELEASE; this.state = STATE_RELEASE;
return; return;
} }
Entities.callEntityMethod(this.grabbedEntity, "continueNearTouch"); Entities.callEntityMethod(this.grabbedEntity, "continueNearGrabNonColliding");
} }