adding fix for far action grab

This commit is contained in:
Wayne Chen 2018-10-08 16:59:39 -07:00
parent ea8229fca4
commit 6f9593dabd

View file

@ -336,15 +336,6 @@ Script.include("/~/system/libraries/Xform.js");
if ((intersection.type === Picks.INTERSECTED_ENTITY && entityType === "Web") ||
intersection.type === Picks.INTERSECTED_OVERLAY || Window.isPointOnDesktopWindow(point2d)) {
return true;
} else if (intersection.type === Picks.INTERSECTED_ENTITY && !Window.isPhysicsEnabled()) {
// add to ignored items.
var data = {
action: 'add',
id: intersection.objectID
};
Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data));
this.ignoredEntities.push(intersection.objectID);
}
return false;
};
@ -405,7 +396,6 @@ Script.include("/~/system/libraries/Xform.js");
this.isReady = function (controllerData) {
if (HMD.active) {
if (this.notPointingAtEntity(controllerData)) {
this.restoreIgnoredEntities();
return makeRunningValues(false, [], []);
}
@ -417,17 +407,28 @@ Script.include("/~/system/libraries/Xform.js");
return makeRunningValues(true, [], []);
} else {
this.destroyContextOverlay();
this.restoreIgnoredEntities();
return makeRunningValues(false, [], []);
}
}
this.restoreIgnoredEntities();
return makeRunningValues(false, [], []);
};
this.run = function (controllerData) {
var intersection = controllerData.rayPicks[this.hand];
if (intersection.type === Picks.INTERSECTED_ENTITY && !Window.isPhysicsEnabled()) {
// add to ignored items.
if (this.ignoredEntities.indexOf(intersection.objectID) === -1) {
var data = {
action: 'add',
id: intersection.objectID
};
Messages.sendMessage('Hifi-Hand-RayPick-Blacklist', JSON.stringify(data));
this.ignoredEntities.push(intersection.objectID);
}
}
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
this.notPointingAtEntity(controllerData) || this.targetIsNull()) {
(this.notPointingAtEntity(controllerData) && Window.isPhysicsEnabled()) || this.targetIsNull()) {
this.endFarGrabAction();
Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity",
this.highlightedEntity);