fix far-trigger

This commit is contained in:
Seth Alves 2016-02-17 12:04:25 -08:00
parent 38430d8d2c
commit 69caf1df4d

View file

@ -921,7 +921,8 @@ function MyController(hand) {
continue; continue;
} }
if (this.state == STATE_SEARCHING && !isPhysical && distance > NEAR_PICK_MAX_DISTANCE && !near) { if (this.state == STATE_SEARCHING &&
!isPhysical && distance > NEAR_PICK_MAX_DISTANCE && !near && !grabbableDataForCandidate.wantsTrigger) {
// we can't distance-grab non-physical // we can't distance-grab non-physical
if (WANT_DEBUG_SEARCH_NAME && propsForCandidate.name == WANT_DEBUG_SEARCH_NAME) { if (WANT_DEBUG_SEARCH_NAME && propsForCandidate.name == WANT_DEBUG_SEARCH_NAME) {
print("grab is skipping '" + WANT_DEBUG_SEARCH_NAME + "': not physical and too far for near-grab"); print("grab is skipping '" + WANT_DEBUG_SEARCH_NAME + "': not physical and too far for near-grab");
@ -1543,11 +1544,13 @@ function MyController(hand) {
var now = Date.now(); var now = Date.now();
if (now - this.lastPickTime > MSECS_PER_SEC / PICKS_PER_SECOND_PER_HAND) { if (now - this.lastPickTime > MSECS_PER_SEC / PICKS_PER_SECOND_PER_HAND) {
var intersection = Entities.findRayIntersection(pickRay, true); var intersection = Entities.findRayIntersection(pickRay, true);
this.lastPickTime = now; if (intersection.accurate) {
if (intersection.entityID != this.grabbedEntity) { this.lastPickTime = now;
this.setState(STATE_RELEASE); if (intersection.entityID != this.grabbedEntity) {
this.callEntityMethodOnGrabbed("stopFarTrigger"); this.setState(STATE_RELEASE);
return; this.callEntityMethodOnGrabbed("stopFarTrigger");
return;
}
} }
} }