Remove extraneous grab entity haptic pulses

This commit is contained in:
David Rowe 2018-11-24 11:38:54 +13:00
parent f1dad3c465
commit 29c268df5a
3 changed files with 0 additions and 22 deletions

View file

@ -256,7 +256,6 @@ Script.include("/~/system/libraries/controllers.js");
}; };
this.endFarParentGrab = function (controllerData) { this.endFarParentGrab = function (controllerData) {
this.hapticTargetID = null;
// var endProps = controllerData.nearbyEntityPropertiesByID[this.targetEntityID]; // var endProps = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
var endProps = Entities.getEntityProperties(this.targetEntityID, DISPATCHER_PROPERTIES); var endProps = Entities.getEntityProperties(this.targetEntityID, DISPATCHER_PROPERTIES);
if (this.thisFarGrabJointIsParent(endProps)) { if (this.thisFarGrabJointIsParent(endProps)) {
@ -410,11 +409,6 @@ Script.include("/~/system/libraries/controllers.js");
if (targetEntity) { if (targetEntity) {
var gtProps = Entities.getEntityProperties(targetEntity, DISPATCHER_PROPERTIES); var gtProps = Entities.getEntityProperties(targetEntity, DISPATCHER_PROPERTIES);
if (entityIsGrabbable(gtProps)) { if (entityIsGrabbable(gtProps)) {
// give haptic feedback
if (gtProps.id !== this.hapticTargetID) {
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
this.hapticTargetID = gtProps.id;
}
// if we've attempted to grab a child, roll up to the root of the tree // if we've attempted to grab a child, roll up to the root of the tree
var groupRootProps = findGroupParent(controllerData, gtProps); var groupRootProps = findGroupParent(controllerData, gtProps);
if (entityIsGrabbable(groupRootProps)) { if (entityIsGrabbable(groupRootProps)) {

View file

@ -24,7 +24,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.hand = hand; this.hand = hand;
this.targetEntityID = null; this.targetEntityID = null;
this.actionID = null; // action this script created... this.actionID = null; // action this script created...
this.hapticTargetID = null;
this.parameters = makeDispatcherModuleParameters( this.parameters = makeDispatcherModuleParameters(
500, 500,
@ -171,10 +170,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
break; break;
} }
if (entityIsGrabbable(props) || entityIsCloneable(props)) { if (entityIsGrabbable(props) || entityIsCloneable(props)) {
if (props.id !== this.hapticTargetID) {
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
this.hapticTargetID = props.id;
}
if (!entityIsCloneable(props)) { if (!entityIsCloneable(props)) {
// if we've attempted to grab a non-cloneable child, roll up to the root of the tree // if we've attempted to grab a non-cloneable child, roll up to the root of the tree
var groupRootProps = findGroupParent(controllerData, props); var groupRootProps = findGroupParent(controllerData, props);
@ -206,7 +201,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
return makeRunningValues(true, [this.targetEntityID], []); return makeRunningValues(true, [this.targetEntityID], []);
} }
} else { } else {
this.hapticTargetID = null;
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }
}; };
@ -216,7 +210,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
if (controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE && if (controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE &&
controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) { controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
this.endNearGrabAction(); this.endNearGrabAction();
this.hapticTargetID = null;
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }

View file

@ -32,7 +32,6 @@ Script.include("/~/system/libraries/controllers.js");
this.previousParentID = {}; this.previousParentID = {};
this.previousParentJointIndex = {}; this.previousParentJointIndex = {};
this.previouslyUnhooked = {}; this.previouslyUnhooked = {};
this.hapticTargetID = null;
this.lastUnequipCheckTime = 0; this.lastUnequipCheckTime = 0;
this.autoUnequipCounter = 0; this.autoUnequipCounter = 0;
this.lastUnexpectedChildrenCheckTime = 0; this.lastUnexpectedChildrenCheckTime = 0;
@ -138,7 +137,6 @@ Script.include("/~/system/libraries/controllers.js");
}; };
this.endNearParentingGrabEntity = function (controllerData) { this.endNearParentingGrabEntity = function (controllerData) {
this.hapticTargetID = null;
var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID]; var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
if (this.thisHandIsParent(props) && !this.robbed) { if (this.thisHandIsParent(props) && !this.robbed) {
Entities.editEntity(this.targetEntityID, { Entities.editEntity(this.targetEntityID, {
@ -248,11 +246,6 @@ Script.include("/~/system/libraries/controllers.js");
continue; continue;
} }
if (entityIsGrabbable(props) || entityIsCloneable(props)) { if (entityIsGrabbable(props) || entityIsCloneable(props)) {
// give haptic feedback
if (props.id !== this.hapticTargetID) {
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
this.hapticTargetID = props.id;
}
if (!entityIsCloneable(props)) { if (!entityIsCloneable(props)) {
// if we've attempted to grab a non-cloneable child, roll up to the root of the tree // if we've attempted to grab a non-cloneable child, roll up to the root of the tree
var groupRootProps = findGroupParent(controllerData, props); var groupRootProps = findGroupParent(controllerData, props);
@ -295,7 +288,6 @@ Script.include("/~/system/libraries/controllers.js");
unhighlightTargetEntity(this.highlightedEntity); unhighlightTargetEntity(this.highlightedEntity);
this.highlightedEntity = null; this.highlightedEntity = null;
} }
this.hapticTargetID = null;
this.robbed = false; this.robbed = false;
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }
@ -316,7 +308,6 @@ Script.include("/~/system/libraries/controllers.js");
this.highlightedEntity = null; this.highlightedEntity = null;
this.grabbing = false; this.grabbing = false;
this.targetEntityID = null; this.targetEntityID = null;
this.hapticTargetID = null;
this.robbed = false; this.robbed = false;
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }