fix grab entity methods

This commit is contained in:
Seth Alves 2017-09-15 12:05:49 -07:00
parent df80b7ecfa
commit b67c571aaa
2 changed files with 11 additions and 9 deletions

View file

@ -111,6 +111,9 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
grabbedEntity: this.targetEntityID, grabbedEntity: this.targetEntityID,
joint: this.hand === RIGHT_HAND ? "RightHand" : "LeftHand" joint: this.hand === RIGHT_HAND ? "RightHand" : "LeftHand"
})); }));
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
Entities.callEntityMethod(this.targetEntityID, "startNearGrab", args);
}; };
// this is for when the action is going to time-out // this is for when the action is going to time-out
@ -182,8 +185,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
return makeRunningValues(false, [], []); // let nearParentGrabEntity handle it return makeRunningValues(false, [], []); // let nearParentGrabEntity handle it
} else { } else {
this.targetEntityID = targetProps.id; this.targetEntityID = targetProps.id;
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
Entities.callEntityMethod(this.targetEntityID, "startNearGrab", args);
return makeRunningValues(true, [this.targetEntityID], []); return makeRunningValues(true, [this.targetEntityID], []);
} }
} else { } else {

View file

@ -6,11 +6,10 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex, NULL_UUID,
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule, enableDispatcherModule, disableDispatcherModule, propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE, TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS, findGroupParent,
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -176,7 +175,8 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.grabbing = false; this.grabbing = false;
var targetProps = this.getTargetProps(controllerData); var targetProps = this.getTargetProps(controllerData);
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE && controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) { if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE &&
controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }
@ -195,7 +195,8 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.run = function (controllerData, deltaTime) { this.run = function (controllerData, deltaTime) {
if (this.grabbing) { if (this.grabbing) {
if (controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE && controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) { if (controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE &&
controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
this.endNearParentingGrabEntity(); this.endNearParentingGrabEntity();
this.hapticTargetID = null; this.hapticTargetID = null;
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);