fix grab entity methods + jshint cleanups

This commit is contained in:
Seth Alves 2017-09-15 10:50:46 -07:00
parent 9f61e7471c
commit 39e6605f6f
15 changed files with 84 additions and 85 deletions

View file

@ -6,10 +6,8 @@
// 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, /* global Script, MyAvatar, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule,
enableDispatcherModule, disableDispatcherModule, getGrabbableData, Vec3, makeDispatcherModuleParameters, makeRunningValues, getEnabledModuleByName, Messages
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, makeRunningValues, NEAR_GRAB_RADIUS,
getEnabledModuleByName
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -20,7 +18,9 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
this.disableModules = false; this.disableModules = false;
this.parameters = makeDispatcherModuleParameters( this.parameters = makeDispatcherModuleParameters(
90, 90,
this.hand === RIGHT_HAND ? ["rightHand", "rightHandEquip", "rightHandTrigger"] : ["leftHand", "leftHandEquip", "leftHandTrigger"], this.hand === RIGHT_HAND ?
["rightHand", "rightHandEquip", "rightHandTrigger"] :
["leftHand", "leftHandEquip", "leftHandTrigger"],
[], [],
100); 100);
@ -61,7 +61,6 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
} }
if (message === 'right') { if (message === 'right') {
rightDisableModules.disableModules = true; rightDisableModules.disableModules = true;
} }
if (message === 'both' || message === 'none') { if (message === 'both' || message === 'none') {
if (message === 'both') { if (message === 'both') {

View file

@ -602,11 +602,8 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
}; };
this.isTargetIDValid = function() { this.isTargetIDValid = function() {
var entityProperties = Entities.getEntityProperties(this.targetEntityID); var entityProperties = Entities.getEntityProperties(this.targetEntityID, ["type"]);
for (var propertry in entityProperties) { return "type" in entityProperties;
return true;
}
return false;
}; };
this.isReady = function (controllerData, deltaTime) { this.isReady = function (controllerData, deltaTime) {

View file

@ -13,7 +13,7 @@
makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
AVATAR_SELF_ID, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic, AVATAR_SELF_ID, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic,
getControllerWorldLocation, projectOntoEntityXYPlane getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, Reticle, Overlays
*/ */
@ -236,10 +236,10 @@ Script.include("/~/system/libraries/controllers.js");
this.actionID = null; this.actionID = null;
} }
// XXX if (this.actionID !== null) {
// if (this.actionID !== null) { var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
// this.callEntityMethodOnGrabbed("startDistanceGrab"); Entities.callEntityMethod(this.targetEntityID, "startDistanceGrab", args);
// } }
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand); Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
this.previousRoomControllerPosition = roomControllerPosition; this.previousRoomControllerPosition = roomControllerPosition;
@ -271,8 +271,8 @@ Script.include("/~/system/libraries/controllers.js");
var handMoved = Vec3.multiply(worldHandDelta, radius); var handMoved = Vec3.multiply(worldHandDelta, radius);
this.currentObjectPosition = Vec3.sum(this.currentObjectPosition, handMoved); this.currentObjectPosition = Vec3.sum(this.currentObjectPosition, handMoved);
// XXX var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
// this.callEntityMethodOnGrabbed("continueDistantGrab"); Entities.callEntityMethod(this.targetEntityID, "continueDistanceGrab", args);
// Update radialVelocity // Update radialVelocity
var lastVelocity = Vec3.multiply(worldHandDelta, 1.0 / deltaObjectTime); var lastVelocity = Vec3.multiply(worldHandDelta, 1.0 / deltaObjectTime);
@ -335,6 +335,10 @@ Script.include("/~/system/libraries/controllers.js");
this.distanceHolding = false; this.distanceHolding = false;
this.distanceRotating = false; this.distanceRotating = false;
Entities.deleteAction(this.grabbedThingID, this.actionID); Entities.deleteAction(this.grabbedThingID, this.actionID);
var args = [this.hand === RIGHT_HAND ? "right" : "left", MyAvatar.sessionUUID];
Entities.callEntityMethod(this.targetEntityID, "releaseGrab", args);
this.actionID = null; this.actionID = null;
this.grabbedThingID = null; this.grabbedThingID = null;
}; };
@ -343,7 +347,8 @@ Script.include("/~/system/libraries/controllers.js");
var intersection = controllerData.rayPicks[this.hand]; var intersection = controllerData.rayPicks[this.hand];
var entityProperty = Entities.getEntityProperties(intersection.objectID); var entityProperty = Entities.getEntityProperties(intersection.objectID);
var entityType = entityProperty.type; var entityType = entityProperty.type;
if ((intersection.type === RayPick.INTERSECTED_ENTITY && entityType === "Web") || intersection.type === RayPick.INTERSECTED_OVERLAY) { if ((intersection.type === RayPick.INTERSECTED_ENTITY && entityType === "Web") ||
intersection.type === RayPick.INTERSECTED_OVERLAY) {
return true; return true;
} }
return false; return false;
@ -354,7 +359,8 @@ Script.include("/~/system/libraries/controllers.js");
this.distanceHolding = false; this.distanceHolding = false;
var worldControllerRotation = getControllerWorldLocation(this.handToController(), true).orientation; var worldControllerRotation = getControllerWorldLocation(this.handToController(), true).orientation;
var controllerRotationDelta = Quat.multiply(worldControllerRotation, Quat.inverse(this.previousWorldControllerRotation)); var controllerRotationDelta =
Quat.multiply(worldControllerRotation, Quat.inverse(this.previousWorldControllerRotation));
// Rotate entity by twice the delta rotation. // Rotate entity by twice the delta rotation.
controllerRotationDelta = Quat.multiply(controllerRotationDelta, controllerRotationDelta); controllerRotationDelta = Quat.multiply(controllerRotationDelta, controllerRotationDelta);
@ -426,7 +432,8 @@ Script.include("/~/system/libraries/controllers.js");
}; };
this.run = function (controllerData) { this.run = function (controllerData) {
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE || this.notPointingAtEntity(controllerData) || this.isPointingAtUI(controllerData)) { if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
this.notPointingAtEntity(controllerData) || this.isPointingAtUI(controllerData)) {
this.endNearGrabAction(); this.endNearGrabAction();
this.laserPointerOff(); this.laserPointerOff();
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
@ -471,6 +478,7 @@ Script.include("/~/system/libraries/controllers.js");
for (var j = 0; j < nearGrabReadiness.length; j++) { for (var j = 0; j < nearGrabReadiness.length; j++) {
if (nearGrabReadiness[j].active) { if (nearGrabReadiness[j].active) {
this.laserPointerOff(); this.laserPointerOff();
this.endNearGrabAction();
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }
} }

View file

@ -6,14 +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, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat, /* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, MyAvatar, getGrabPointSphereOffset,
getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities, NULL_UUID, makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters,
enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable,
makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
AVATAR_SELF_ID, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic, AVATAR_SELF_ID, DEFAULT_SEARCH_SPHERE_DISTANCE, getGrabbableData
getControllerWorldLocation, projectOntoEntityXYPlane, getGrabbableData
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");

View file

@ -5,13 +5,12 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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, /* jslint bitwise: true */
NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, ZERO_VEC, /* global Script, Controller, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
AVATAR_SELF_ID, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, Settings, getGrabPointSphereOffset, Messages, makeDispatcherModuleParameters, AVATAR_SELF_ID, HMD, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE,
COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE,
DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE, getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, LaserPointers, RayPick
isInEditMode
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");

View file

@ -149,7 +149,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
var nearbyEntityProperties = controllerData.nearbyEntityProperties[this.hand]; var nearbyEntityProperties = controllerData.nearbyEntityProperties[this.hand];
for (var i = 0; i < nearbyEntityProperties.length; i++) { for (var i = 0; i < nearbyEntityProperties.length; i++) {
var props = nearbyEntityProperties[i]; var props = nearbyEntityProperties[i];
var handPosition = controllerData.controllerLocations[this.hand].position;
if (props.distance > NEAR_GRAB_RADIUS) { if (props.distance > NEAR_GRAB_RADIUS) {
break; break;
} }
@ -173,7 +172,8 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.targetEntityID = null; this.targetEntityID = null;
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, [], []);
} }
@ -182,6 +182,8 @@ 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 {
@ -192,7 +194,8 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.run = function (controllerData) { this.run = function (controllerData) {
if (this.actionID) { if (this.actionID) {
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.endNearGrabAction(); this.endNearGrabAction();
this.hapticTargetID = null; this.hapticTargetID = null;
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);

View file

@ -6,10 +6,9 @@
// 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, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, /* global Script, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex, NULL_UUID,
getControllerJointIndex, NULL_UUID, enableDispatcherModule, disableDispatcherModule, enableDispatcherModule, disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, makeDispatcherModuleParameters, Overlays, makeRunningValues, Vec3
makeDispatcherModuleParameters, Overlays, makeRunningValues
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");

View file

@ -6,9 +6,8 @@
// 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, /* global Script, Entities, MyAvatar, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule, getGrabbableData,
enableDispatcherModule, disableDispatcherModule, getGrabbableData, Vec3, Vec3, TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, makeRunningValues, NEAR_GRAB_RADIUS
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, makeRunningValues, NEAR_GRAB_RADIUS
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");

View file

@ -5,13 +5,11 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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, /* global Script, Entities, Controller, RIGHT_HAND, LEFT_HAND, NULL_UUID, enableDispatcherModule, disableDispatcherModule,
NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeRunningValues, makeRunningValues, Messages, Quat, Vec3, makeDispatcherModuleParameters, Overlays, ZERO_VEC, AVATAR_SELF_ID, HMD,
Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, ZERO_VEC, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE,
AVATAR_SELF_ID, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, Settings, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE,
COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE, LaserPointers, RayPick, ContextOverlay
DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE,
DISPATCHER_PROPERTIES
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");

View file

@ -7,9 +7,7 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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 getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings, /* global Script, Vec3, MyAvatar, RIGHT_HAND */
Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset,
setGrabCommunications, Menu, HMD, isInEditMode, AvatarList */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */ /* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function () { (function () {
@ -37,7 +35,8 @@
}; };
this.triggersPressed = function(controllerData) { this.triggersPressed = function(controllerData) {
if (controllerData.triggerClicks[this.hand] && controllerData.secondaryValues[this.hand] > dispatcherUtils.BUMPER_ON_VALUE) { if (controllerData.triggerClicks[this.hand] &&
controllerData.secondaryValues[this.hand] > dispatcherUtils.BUMPER_ON_VALUE) {
return true; return true;
} }
return false; return false;
@ -58,7 +57,8 @@
var otherModule = this.getOtherModule(); var otherModule = this.getOtherModule();
if (this.triggersPressed(controllerData) && otherModule.triggersPressed(controllerData)) { if (this.triggersPressed(controllerData) && otherModule.triggersPressed(controllerData)) {
if (this.hand === dispatcherUtils.RIGHT_HAND) { if (this.hand === dispatcherUtils.RIGHT_HAND) {
var scalingCurrentDistance = Vec3.length(Vec3.subtract(controllerData.controllerLocations[this.hand].position, var scalingCurrentDistance =
Vec3.length(Vec3.subtract(controllerData.controllerLocations[this.hand].position,
controllerData.controllerLocations[this.otherHand()].position)); controllerData.controllerLocations[this.otherHand()].position));
var newAvatarScale = (scalingCurrentDistance / this.scalingStartDistance) * this.scalingStartAvatarScale; var newAvatarScale = (scalingCurrentDistance / this.scalingStartDistance) * this.scalingStartAvatarScale;

View file

@ -8,7 +8,8 @@
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND,
NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeRunningValues, NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, ZERO_VEC, Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, ZERO_VEC,
AVATAR_SELF_ID, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, Settings, getGrabPointSphereOffset AVATAR_SELF_ID, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, Settings, getGrabPointSphereOffset,
getEnabledModuleByName
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -647,7 +648,8 @@ Script.include("/~/system/libraries/controllers.js");
}; };
this.overlayLaserActive = function(controllerData) { this.overlayLaserActive = function(controllerData) {
var overlayLaserModule = getEnabledModuleByName(this.hand === RIGHT_HAND ? "RightOverlayLaserInput" : "LeftOverlayLaserInput"); var overlayLaserModule =
getEnabledModuleByName(this.hand === RIGHT_HAND ? "RightOverlayLaserInput" : "LeftOverlayLaserInput");
if (overlayLaserModule) { if (overlayLaserModule) {
return overlayLaserModule.isReady(controllerData).active; return overlayLaserModule.isReady(controllerData).active;
} }

View file

@ -8,11 +8,11 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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
/* jslint bitwise: true */
/* 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, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3,
Messages, makeDispatcherModuleParameters, makeRunningValues, Settings, entityHasActions, LaserPointers, RayPick, HMD, Uuid, AvatarList
Vec3, Overlays, flatten, Xform, getControllerWorldLocation, ensureDynamic
*/ */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */ /* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
@ -111,7 +111,7 @@ var seatEnd = {
url: SEAT_MODEL_URL, url: SEAT_MODEL_URL,
dimensions: TARGET_MODEL_DIMENSIONS, dimensions: TARGET_MODEL_DIMENSIONS,
ignoreRayIntersection: true ignoreRayIntersection: true
} };
var teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd}, var teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd},
{name: "teleport", path: teleportPath, end: teleportEnd}, {name: "teleport", path: teleportPath, end: teleportEnd},
@ -228,7 +228,7 @@ function Teleporter(hand) {
this.buttonPress = function(value) { this.buttonPress = function(value) {
_this.buttonValue = value; _this.buttonValue = value;
} };
this.parameters = makeDispatcherModuleParameters( this.parameters = makeDispatcherModuleParameters(
80, 80,
@ -249,7 +249,6 @@ function Teleporter(hand) {
}, COOL_IN_DURATION); }, COOL_IN_DURATION);
}; };
this.isReady = function(controllerData, deltaTime) { this.isReady = function(controllerData, deltaTime) {
var otherModule = this.getOtherModule(); var otherModule = this.getOtherModule();
if (_this.buttonValue !== 0 && !otherModule.active) { if (_this.buttonValue !== 0 && !otherModule.active) {
@ -301,7 +300,6 @@ function Teleporter(hand) {
} else { } else {
result = LaserPointers.getPrevRayPickResult(_this.teleportRayHandVisible); result = LaserPointers.getPrevRayPickResult(_this.teleportRayHandVisible);
} }
teleportLocationType = getTeleportTargetType(result); teleportLocationType = getTeleportTargetType(result);
} }
@ -483,7 +481,7 @@ function Teleporter(hand) {
LaserPointers.setIgnoreEntities(teleporter.teleportRayLeftInvisible, ignoredEntities); LaserPointers.setIgnoreEntities(teleporter.teleportRayLeftInvisible, ignoredEntities);
LaserPointers.setIgnoreEntities(teleporter.teleportRayHeadVisible, ignoredEntities); LaserPointers.setIgnoreEntities(teleporter.teleportRayHeadVisible, ignoredEntities);
LaserPointers.setIgnoreEntities(teleporter.teleportRayHeadInvisible, ignoredEntities); LaserPointers.setIgnoreEntities(teleporter.teleportRayHeadInvisible, ignoredEntities);
} };
var isDisabled = false; var isDisabled = false;
var handleTeleportMessages = function(channel, message, sender) { var handleTeleportMessages = function(channel, message, sender) {
@ -501,7 +499,9 @@ function Teleporter(hand) {
if (message === 'none') { if (message === 'none') {
isDisabled = false; isDisabled = false;
} }
} else if (channel === 'Hifi-Teleport-Ignore-Add' && !Uuid.isNull(message) && ignoredEntities.indexOf(message) === -1) { } else if (channel === 'Hifi-Teleport-Ignore-Add' &&
!Uuid.isNull(message) &&
ignoredEntities.indexOf(message) === -1) {
ignoredEntities.push(message); ignoredEntities.push(message);
setIgnoreEntities(); setIgnoreEntities();
} else if (channel === 'Hifi-Teleport-Ignore-Remove' && !Uuid.isNull(message)) { } else if (channel === 'Hifi-Teleport-Ignore-Remove' && !Uuid.isNull(message)) {

View file

@ -7,13 +7,10 @@
/* jslint bitwise: true */ /* jslint bitwise: true */
/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat, /* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Vec3, Quat, getGrabPointSphereOffset,
getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities, NULL_UUID, makeRunningValues, Entities, NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters,
enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable,
makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
AVATAR_SELF_ID, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC AVATAR_SELF_ID, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, ZERO_VEC, Overlays
*/ */
Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Script.include("/~/system/libraries/controllerDispatcherUtils.js");

View file

@ -5,7 +5,8 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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 entityIsCloneable:true, getGrabbableData:true, cloneEntity:true propsAreCloneDynamic:true */ /* global entityIsCloneable:true, getGrabbableData:true, cloneEntity:true, propsAreCloneDynamic:true, Script,
propsAreCloneDynamic:true, Entities*/
Script.include("/~/system/controllers/controllerDispatcherUtils.js"); Script.include("/~/system/controllers/controllerDispatcherUtils.js");

View file

@ -39,7 +39,8 @@
projectOntoOverlayXYPlane:true, projectOntoOverlayXYPlane:true,
entityHasActions:true, entityHasActions:true,
ensureDynamic:true, ensureDynamic:true,
findGroupParent:true findGroupParent:true,
BUMPER_ON_VALUE:true
*/ */
MSECS_PER_SEC = 1000.0; MSECS_PER_SEC = 1000.0;