fixed secondary triggers and chest lid

This commit is contained in:
druiz17 2017-09-12 14:43:06 -07:00
parent 0b360f455c
commit b3ff5c86f7
4 changed files with 14 additions and 13 deletions

View file

@ -10,7 +10,7 @@
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable,
Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues,
TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity,
HAPTIC_PULSE_STRENGTH, HAPTIC_STYLUS_DURATION
HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE
*/
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -63,7 +63,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
var grabbableData = getGrabbableData(targetProps);
this.ignoreIK = grabbableData.ignoreIK;
this.kinematicGrab = grabbableData.kinematicGrab;
this.kinematicGrab = grabbableData.kinematic;
var handRotation;
var handPosition;
@ -192,7 +192,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.run = function (controllerData) {
if (this.actionID) {
if (controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) {
if (controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE && controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
this.endNearGrabAction();
this.hapticTargetID = null;
return makeRunningValues(false, [], []);
@ -211,7 +211,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
var targetProps = this.getTargetProps(controllerData);
if (targetProps) {
if (controllerData.triggerClicks[this.hand] === 1 || controllerData.secondaryValues[this.hand] === 1) {
if (controllerData.triggerClicks[this.hand] || controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) {
// switch to grabbing
var targetCloneable = entityIsCloneable(targetProps);
if (targetCloneable) {

View file

@ -10,7 +10,7 @@
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, TRIGGER_OFF_VALUE,
makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, HAPTIC_STYLUS_DURATION
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE
*/
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -195,7 +195,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.run = function (controllerData, deltaTime) {
if (this.grabbing) {
if (controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) {
if (controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE && controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
this.endNearParentingGrabEntity();
this.hapticTargetID = null;
return makeRunningValues(false, [], []);
@ -217,7 +217,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
if (!readiness.active) {
return readiness;
}
if (controllerData.triggerClicks[this.hand] === 1 || controllerData.secondaryValues[this.hand] === 1) {
if (controllerData.triggerClicks[this.hand] || controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) {
// switch to grab
var targetProps = this.getTargetProps(controllerData);
var targetCloneable = entityIsCloneable(targetProps);

View file

@ -12,10 +12,9 @@
setGrabCommunications, Menu, HMD, isInEditMode, AvatarList */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//Script.include("/~/system/libraries/controllerDispatcherUtils.js");
(function () {
var dispatcherUtils = Script.require("/~/system/libraries/controllerDispatcherUtils.js");
var BUMPER_ON_VALUE = 0.5;
function ScaleAvatar(hand) {
this.hand = hand;
this.scalingStartAvatarScale = 0;
@ -38,7 +37,7 @@
};
this.triggersPressed = function(controllerData) {
if (controllerData.triggerClicks[this.hand] && controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) {
if (controllerData.triggerClicks[this.hand] && controllerData.secondaryValues[this.hand] > dispatcherUtils.BUMPER_ON_VALUE) {
return true;
}
return false;

View file

@ -66,6 +66,7 @@ DEFAULT_REGISTRATION_POINT = { x: 0.5, y: 0.5, z: 0.5 };
TRIGGER_OFF_VALUE = 0.1;
TRIGGER_ON_VALUE = TRIGGER_OFF_VALUE + 0.05; // Squeezed just enough to activate search or near grab
BUMPER_ON_VALUE = 0.5;
PICK_MAX_DISTANCE = 500; // max length of pick-ray
DEFAULT_SEARCH_SPHERE_DISTANCE = 1000; // how far from camera to search intersection?
@ -157,8 +158,8 @@ getGrabbableData = function (props) {
if (!grabbableData.hasOwnProperty("ignoreIK")) {
grabbableData.ignoreIK = true;
}
if (!grabbableData.hasOwnProperty("kinematicGrab")) {
grabbableData.kinematicGrab = true;
if (!grabbableData.hasOwnProperty("kinematic")) {
grabbableData.kinematic = true;
}
if (!grabbableData.hasOwnProperty("wantsTrigger")) {
grabbableData.wantsTrigger = false;
@ -315,6 +316,7 @@ if (typeof module !== 'undefined') {
disableDispatcherModule: disableDispatcherModule,
makeRunningValues: makeRunningValues,
LEFT_HAND: LEFT_HAND,
RIGHT_HAND: RIGHT_HAND
RIGHT_HAND: RIGHT_HAND,
BUMPER_ON_VALUE: BUMPER_ON_VALUE
};
}