Update system scripts to use new properties

This commit is contained in:
David Rowe 2017-10-14 08:32:14 +13:00
parent 949ed3b33d
commit fc4e440dc4
22 changed files with 109 additions and 255 deletions

View file

@ -12,7 +12,6 @@
Script.include("libraries/utils.js"); Script.include("libraries/utils.js");
var NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
var DEFAULT_WEARABLE_DATA = { var DEFAULT_WEARABLE_DATA = {
joints: {} joints: {}
}; };
@ -116,7 +115,7 @@ function AttachedEntitiesManager() {
var allowedJoints = getEntityCustomData('wearable', grabbedEntity, DEFAULT_WEARABLE_DATA).joints; var allowedJoints = getEntityCustomData('wearable', grabbedEntity, DEFAULT_WEARABLE_DATA).joints;
var props = Entities.getEntityProperties(grabbedEntity, ["position", "parentID", "parentJointIndex"]); var props = Entities.getEntityProperties(grabbedEntity, ["position", "parentID", "parentJointIndex"]);
if (props.parentID === NULL_UUID || props.parentID === MyAvatar.sessionUUID) { if (props.parentID === Uuid.NULL || props.parentID === MyAvatar.sessionUUID) {
var bestJointName = ""; var bestJointName = "";
var bestJointIndex = -1; var bestJointIndex = -1;
var bestJointDistance = 0; var bestJointDistance = 0;
@ -168,7 +167,7 @@ function AttachedEntitiesManager() {
if (updatePresets) { if (updatePresets) {
this.updateRelativeOffsets(newEntity); this.updateRelativeOffsets(newEntity);
} }
} else if (props.parentID != NULL_UUID) { } else if (props.parentID != Uuid.NULL) {
// drop the entity and set it to have no parent (not on the avatar), unless it's being equipped in a hand. // drop the entity and set it to have no parent (not on the avatar), unless it's being equipped in a hand.
if (props.parentID === MyAvatar.sessionUUID && if (props.parentID === MyAvatar.sessionUUID &&
(props.parentJointIndex == MyAvatar.getJointIndex("RightHand") || (props.parentJointIndex == MyAvatar.getJointIndex("RightHand") ||
@ -176,7 +175,7 @@ function AttachedEntitiesManager() {
// this is equipped on a hand -- don't clear the parent. // this is equipped on a hand -- don't clear the parent.
} else { } else {
var wearProps = Entities.getEntityProperties(grabbedEntity); var wearProps = Entities.getEntityProperties(grabbedEntity);
wearProps.parentID = NULL_UUID; wearProps.parentID = Uuid.NULL;
wearProps.parentJointIndex = -1; wearProps.parentJointIndex = -1;
delete wearProps.id; delete wearProps.id;
delete wearProps.created; delete wearProps.created;

View file

@ -30,7 +30,6 @@ var OVERLAY_DATA = {
}; };
var AVATAR_MOVE_FOR_ACTIVE_DISTANCE = 0.8; // meters -- no longer away if avatar moves this far while away var AVATAR_MOVE_FOR_ACTIVE_DISTANCE = 0.8; // meters -- no longer away if avatar moves this far while away
var AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}";
var CAMERA_MATRIX = -7; var CAMERA_MATRIX = -7;
var OVERLAY_DATA_HMD = { var OVERLAY_DATA_HMD = {
@ -44,7 +43,7 @@ var OVERLAY_DATA_HMD = {
scale: 2 * MyAvatar.sensorToWorldScale, scale: 2 * MyAvatar.sensorToWorldScale,
emissive: true, emissive: true,
drawInFront: true, drawInFront: true,
parentID: AVATAR_SELF_ID, parentID: Uuid.SELF,
parentJointIndex: CAMERA_MATRIX parentJointIndex: CAMERA_MATRIX
}; };

View file

@ -9,8 +9,6 @@
/* globals createControllerDisplay:true deleteControllerDisplay:true */ /* globals createControllerDisplay:true deleteControllerDisplay:true */
var PARENT_ID = "{00000000-0000-0000-0000-000000000001}";
function clamp(value, min, max) { function clamp(value, min, max) {
if (value < min) { if (value < min) {
return min; return min;
@ -178,7 +176,7 @@ createControllerDisplay = function(config) {
dimensions: Vec3.multiply(sensorScaleFactor, controller.dimensions), dimensions: Vec3.multiply(sensorScaleFactor, controller.dimensions),
localRotation: controller.rotation, localRotation: controller.rotation,
localPosition: Vec3.multiply(sensorScaleFactor, position), localPosition: Vec3.multiply(sensorScaleFactor, position),
parentID: PARENT_ID, parentID: Uuid.SELF,
parentJointIndex: controller.jointIndex, parentJointIndex: controller.jointIndex,
ignoreRayIntersection: true ignoreRayIntersection: true
}); });
@ -198,7 +196,7 @@ createControllerDisplay = function(config) {
url: part.modelURL, url: part.modelURL,
localPosition: partPosition, localPosition: partPosition,
localRotation: innerRotation, localRotation: innerRotation,
parentID: PARENT_ID, parentID: Uuid.SELF,
parentJointIndex: controller.jointIndex, parentJointIndex: controller.jointIndex,
ignoreRayIntersection: true ignoreRayIntersection: true
}; };

View file

@ -7,7 +7,7 @@
/* 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, enableDispatcherModule, disableDispatcherModule, getControllerJointIndex, enableDispatcherModule, disableDispatcherModule,
Messages, makeDispatcherModuleParameters, makeRunningValues, Settings, entityHasActions, Messages, makeDispatcherModuleParameters, makeRunningValues, Settings, entityHasActions,
Vec3, Overlays, flatten, Xform, getControllerWorldLocation, ensureDynamic, entityIsCloneable, Vec3, Overlays, flatten, Xform, getControllerWorldLocation, ensureDynamic, entityIsCloneable,
cloneEntity, DISPATCHER_PROPERTIES cloneEntity, DISPATCHER_PROPERTIES
@ -333,7 +333,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
var props = controllerData.nearbyEntityPropertiesByID[hotspot.entityID]; var props = controllerData.nearbyEntityPropertiesByID[hotspot.entityID];
var hasParent = true; var hasParent = true;
if (props.parentID === NULL_UUID) { if (props.parentID === Uuid.NULL) {
hasParent = false; hasParent = false;
} }
@ -539,7 +539,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
this.endEquipEntity = function () { this.endEquipEntity = function () {
Entities.editEntity(this.targetEntityID, { Entities.editEntity(this.targetEntityID, {
parentID: NULL_UUID, parentID: Uuid.NULL,
parentJointIndex: -1 parentJointIndex: -1
}); });

View file

@ -8,7 +8,7 @@
/* 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, Mat4, MyAvatar, Vec3, Camera, Quat,
getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities, NULL_UUID, getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities,
enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable, enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable,
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,
@ -238,7 +238,7 @@ Script.include("/~/system/libraries/controllers.js");
tag: "far-grab-" + MyAvatar.sessionUUID, tag: "far-grab-" + MyAvatar.sessionUUID,
ttl: ACTION_TTL ttl: ACTION_TTL
}); });
if (this.actionID === NULL_UUID) { if (this.actionID === Uuid.NULL) {
this.actionID = null; this.actionID = null;
} }

View file

@ -11,7 +11,7 @@
// //
/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat, /* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat,
getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities, NULL_UUID, getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities,
enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable, enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable,
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,

View file

@ -6,7 +6,7 @@
// 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, Controller, RIGHT_HAND, LEFT_HAND,
getControllerJointIndex, getGrabbableData, NULL_UUID, enableDispatcherModule, disableDispatcherModule, getControllerJointIndex, getGrabbableData, enableDispatcherModule, disableDispatcherModule,
propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable, propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable,
Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues, Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues,
TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity, TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity,
@ -101,7 +101,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
kinematicSetVelocity: true, kinematicSetVelocity: true,
ignoreIK: this.ignoreIK ignoreIK: this.ignoreIK
}); });
if (this.actionID === NULL_UUID) { if (this.actionID === Uuid.NULL) {
this.actionID = null; this.actionID = null;
return; return;
} }
@ -183,7 +183,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
if (targetProps) { if (targetProps) {
if ((!propsArePhysical(targetProps) && !propsAreCloneDynamic(targetProps)) || if ((!propsArePhysical(targetProps) && !propsAreCloneDynamic(targetProps)) ||
targetProps.parentID != NULL_UUID) { targetProps.parentID !== Uuid.NULL) {
return makeRunningValues(false, [], []); // let nearParentGrabEntity handle it return makeRunningValues(false, [], []); // let nearParentGrabEntity handle it
} else { } else {
this.targetEntityID = targetProps.id; this.targetEntityID = targetProps.id;

View file

@ -6,7 +6,7 @@
// 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, getControllerJointIndex, NULL_UUID, /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex,
enableDispatcherModule, disableDispatcherModule, propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, enableDispatcherModule, disableDispatcherModule, propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS, TRIGGER_OFF_VALUE, makeDispatcherModuleParameters, entityIsGrabbable, makeRunningValues, NEAR_GRAB_RADIUS,
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH, findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
@ -120,7 +120,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.hapticTargetID = null; this.hapticTargetID = null;
var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID]; var props = controllerData.nearbyEntityPropertiesByID[this.targetEntityID];
if (this.thisHandIsParent(props)) { if (this.thisHandIsParent(props)) {
if (this.previousParentID[this.targetEntityID] === NULL_UUID || this.previousParentID === undefined) { if (this.previousParentID[this.targetEntityID] === Uuid.NULL || this.previousParentID === undefined) {
Entities.editEntity(this.targetEntityID, { Entities.editEntity(this.targetEntityID, {
parentID: this.previousParentID[this.targetEntityID], parentID: this.previousParentID[this.targetEntityID],
parentJointIndex: this.previousParentJointIndex[this.targetEntityID] parentJointIndex: this.previousParentJointIndex[this.targetEntityID]
@ -193,7 +193,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
var UNHOOK_LOOP_DETECT_MS = 200; var UNHOOK_LOOP_DETECT_MS = 200;
if (_this.previouslyUnhooked[childID]) { if (_this.previouslyUnhooked[childID]) {
if (now - _this.previouslyUnhooked[childID] < UNHOOK_LOOP_DETECT_MS) { if (now - _this.previouslyUnhooked[childID] < UNHOOK_LOOP_DETECT_MS) {
previousParentID = NULL_UUID; previousParentID = Uuid.NULL;
previousParentJointIndex = -1; previousParentJointIndex = -1;
} }
} }
@ -204,7 +204,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
parentJointIndex: previousParentJointIndex parentJointIndex: previousParentJointIndex
}); });
} else { } else {
Entities.editEntity(childID, { parentID: NULL_UUID }); Entities.editEntity(childID, { parentID: Uuid.NULL });
} }
}); });
} }
@ -253,7 +253,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
if (targetProps) { if (targetProps) {
if ((propsArePhysical(targetProps) || propsAreCloneDynamic(targetProps)) && if ((propsArePhysical(targetProps) || propsAreCloneDynamic(targetProps)) &&
targetProps.parentID == NULL_UUID) { targetProps.parentID === Uuid.NULL) {
return makeRunningValues(false, [], []); // let nearActionGrabEntity handle it return makeRunningValues(false, [], []); // let nearActionGrabEntity handle it
} else { } else {
this.targetEntityID = targetProps.id; this.targetEntityID = targetProps.id;
@ -268,7 +268,7 @@ 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 && if (controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE &&
controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) { controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
this.endNearParentingGrabEntity(controllerData); this.endNearParentingGrabEntity(controllerData);
return makeRunningValues(false, [], []); return makeRunningValues(false, [], []);
} }

View file

@ -6,7 +6,7 @@
// 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, getControllerJointIndex, NULL_UUID, /* global Script, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex,
enableDispatcherModule, disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, enableDispatcherModule, disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
makeDispatcherModuleParameters, Overlays, makeRunningValues, Vec3, resizeTablet, getTabletWidthFromSettings, makeDispatcherModuleParameters, Overlays, makeRunningValues, Vec3, resizeTablet, getTabletWidthFromSettings,
NEAR_GRAB_RADIUS NEAR_GRAB_RADIUS
@ -130,9 +130,9 @@ Script.include("/~/system/libraries/utils.js");
this.endNearParentingGrabOverlay = function () { this.endNearParentingGrabOverlay = function () {
var previousParentID = this.previousParentID[this.grabbedThingID]; var previousParentID = this.previousParentID[this.grabbedThingID];
if ((previousParentID === NULL_UUID || previousParentID === null) && !this.robbed) { if ((previousParentID === Uuid.NULL || previousParentID === null) && !this.robbed) {
Overlays.editOverlay(this.grabbedThingID, { Overlays.editOverlay(this.grabbedThingID, {
parentID: NULL_UUID, parentID: Uuid.NULL,
parentJointIndex: -1 parentJointIndex: -1
}); });
} else if (!this.robbed){ } else if (!this.robbed){

View file

@ -5,7 +5,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 Script, Entities, Controller, RIGHT_HAND, LEFT_HAND, NULL_UUID, enableDispatcherModule, disableDispatcherModule, /* global Script, Entities, Controller, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule,
makeRunningValues, Messages, Quat, Vec3, makeDispatcherModuleParameters, Overlays, ZERO_VEC, AVATAR_SELF_ID, HMD, makeRunningValues, Messages, Quat, Vec3, makeDispatcherModuleParameters, Overlays, ZERO_VEC, AVATAR_SELF_ID, HMD,
INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE,
COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE,

View file

@ -6,7 +6,7 @@
// 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, Controller, RIGHT_HAND, LEFT_HAND,
NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeRunningValues, 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 getEnabledModuleByName
@ -286,7 +286,7 @@ Script.include("/~/system/libraries/controllers.js");
} }
// add the tabletScreen, if it is valid // add the tabletScreen, if it is valid
if (HMD.tabletScreenID && HMD.tabletScreenID !== NULL_UUID && if (HMD.tabletScreenID && HMD.tabletScreenID !== Uuid.NULL &&
Overlays.getProperty(HMD.tabletScreenID, "visible")) { Overlays.getProperty(HMD.tabletScreenID, "visible")) {
stylusTarget = TouchEventUtils.calculateTouchTargetFromOverlay(this.stylusTip, HMD.tabletScreenID); stylusTarget = TouchEventUtils.calculateTouchTargetFromOverlay(this.stylusTip, HMD.tabletScreenID);
if (stylusTarget) { if (stylusTarget) {
@ -295,7 +295,7 @@ Script.include("/~/system/libraries/controllers.js");
} }
// add the tablet home button. // add the tablet home button.
if (HMD.homeButtonID && HMD.homeButtonID !== NULL_UUID && if (HMD.homeButtonID && HMD.homeButtonID !== Uuid.NULL &&
Overlays.getProperty(HMD.homeButtonID, "visible")) { Overlays.getProperty(HMD.homeButtonID, "visible")) {
stylusTarget = TouchEventUtils.calculateTouchTargetFromOverlay(this.stylusTip, HMD.homeButtonID); stylusTarget = TouchEventUtils.calculateTouchTargetFromOverlay(this.stylusTip, HMD.homeButtonID);
if (stylusTarget) { if (stylusTarget) {

View file

@ -10,7 +10,7 @@
/* jslint bitwise: true */ /* jslint bitwise: true */
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex, NULL_UUID, /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, AVATAR_SELF_ID, getControllerJointIndex,
enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3, enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3,
LaserPointers, RayPick, HMD, Uuid, AvatarList LaserPointers, RayPick, HMD, Uuid, AvatarList
*/ */

View file

@ -8,7 +8,7 @@
/* jslint bitwise: true */ /* jslint bitwise: true */
/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Vec3, Quat, getGrabPointSphereOffset, /* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Vec3, Quat, getGrabPointSphereOffset,
makeRunningValues, Entities, NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters, makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters,
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_ON_VALUE, ZERO_VEC, Overlays AVATAR_SELF_ID, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, ZERO_VEC, Overlays
*/ */
@ -90,15 +90,15 @@ Script.include("/~/system/libraries/controllers.js");
var HAPTIC_STYLUS_DURATION = 20.0; var HAPTIC_STYLUS_DURATION = 20.0;
function laserTargetHasKeyboardFocus(laserTarget) { function laserTargetHasKeyboardFocus(laserTarget) {
if (laserTarget && laserTarget !== NULL_UUID) { if (laserTarget && laserTarget !== Uuid.NULL) {
return Entities.keyboardFocusOverlay === laserTarget; return Entities.keyboardFocusOverlay === laserTarget;
} }
} }
function setKeyboardFocusOnLaserTarget(laserTarget) { function setKeyboardFocusOnLaserTarget(laserTarget) {
if (laserTarget && laserTarget !== NULL_UUID) { if (laserTarget && laserTarget !== Uuid.NULL) {
Entities.wantsHandControllerPointerEvents(laserTarget); Entities.wantsHandControllerPointerEvents(laserTarget);
Overlays.keyboardFocusOverlay = NULL_UUID; Overlays.keyboardFocusOverlay = Uuid.NULL;
Entities.keyboardFocusEntity = laserTarget; Entities.keyboardFocusEntity = laserTarget;
} }
} }
@ -117,7 +117,7 @@ Script.include("/~/system/libraries/controllers.js");
button: "None" button: "None"
}; };
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) { if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendHoverEnterEntity(laserTarget.entityID, pointerEvent); Entities.sendHoverEnterEntity(laserTarget.entityID, pointerEvent);
} }
} }
@ -137,7 +137,7 @@ Script.include("/~/system/libraries/controllers.js");
button: "None" button: "None"
}; };
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) { if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendMouseMoveOnEntity(laserTarget.entityID, pointerEvent); Entities.sendMouseMoveOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendHoverOverEntity(laserTarget.entityID, pointerEvent); Entities.sendHoverOverEntity(laserTarget.entityID, pointerEvent);
} }
@ -156,7 +156,7 @@ Script.include("/~/system/libraries/controllers.js");
isPrimaryHeld: true isPrimaryHeld: true
}; };
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) { if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendMousePressOnEntity(laserTarget.entityID, pointerEvent); Entities.sendMousePressOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendClickDownOnEntity(laserTarget.entityID, pointerEvent); Entities.sendClickDownOnEntity(laserTarget.entityID, pointerEvent);
} }
@ -173,7 +173,7 @@ Script.include("/~/system/libraries/controllers.js");
button: "Primary" button: "Primary"
}; };
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) { if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendMouseReleaseOnEntity(laserTarget.entityID, pointerEvent); Entities.sendMouseReleaseOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendClickReleaseOnEntity(laserTarget.entityID, pointerEvent); Entities.sendClickReleaseOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendHoverLeaveEntity(laserTarget.entityID, pointerEvent); Entities.sendHoverLeaveEntity(laserTarget.entityID, pointerEvent);
@ -192,7 +192,7 @@ Script.include("/~/system/libraries/controllers.js");
isPrimaryHeld: true isPrimaryHeld: true
}; };
if (laserTarget.entityID && laserTarget.entityID !== NULL_UUID) { if (laserTarget.entityID && laserTarget.entityID !== Uuid.NULL) {
Entities.sendMouseMoveOnEntity(laserTarget.entityID, pointerEvent); Entities.sendMouseMoveOnEntity(laserTarget.entityID, pointerEvent);
Entities.sendHoldingClickOnEntity(laserTarget.entityID, pointerEvent); Entities.sendHoldingClickOnEntity(laserTarget.entityID, pointerEvent);
} }

View file

@ -1360,7 +1360,7 @@ function unparentSelectedEntities() {
} }
selectedEntities.forEach(function (id, index) { selectedEntities.forEach(function (id, index) {
var parentId = Entities.getEntityProperties(id, ["parentID"]).parentID; var parentId = Entities.getEntityProperties(id, ["parentID"]).parentID;
if (parentId !== null && parentId.length > 0 && parentId !== "{00000000-0000-0000-0000-000000000000}") { if (parentId !== null && parentId.length > 0 && parentId !== Uuid.NULL) {
parentCheck = true; parentCheck = true;
} }
Entities.editEntity(id, {parentID: null}); Entities.editEntity(id, {parentID: null});

View file

@ -25,7 +25,6 @@ var ROT_LANDSCAPE = {x: 1.0, y: 1.0, z: 0, w: 0};
var ROT_LANDSCAPE_WINDOW = {x: 0.0, y: 0.0, z: 0.0, w: 0}; var ROT_LANDSCAPE_WINDOW = {x: 0.0, y: 0.0, z: 0.0, w: 0};
var TABLET_TEXTURE_RESOLUTION = { x: 480, y: 706 }; var TABLET_TEXTURE_RESOLUTION = { x: 480, y: 706 };
var INCHES_TO_METERS = 1 / 39.3701; var INCHES_TO_METERS = 1 / 39.3701;
var AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}";
var NO_HANDS = -1; var NO_HANDS = -1;
var DELAY_FOR_30HZ = 33; // milliseconds var DELAY_FOR_30HZ = 33; // milliseconds
@ -100,7 +99,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
"grabbableKey": {"grabbable": true} "grabbableKey": {"grabbable": true}
}), }),
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth }, dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth },
parentID: AVATAR_SELF_ID, parentID: Uuid.SELF,
visible: visible visible: visible
}; };
@ -414,7 +413,7 @@ WebTablet.prototype.register = function() {
WebTablet.prototype.cleanUpOldTabletsOnJoint = function(jointIndex) { WebTablet.prototype.cleanUpOldTabletsOnJoint = function(jointIndex) {
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, jointIndex); var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, jointIndex);
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, jointIndex)); children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, jointIndex));
children.forEach(function(childID) { children.forEach(function(childID) {
var props = Entities.getEntityProperties(childID, ["name"]); var props = Entities.getEntityProperties(childID, ["name"]);
if (props.name === "WebTablet Tablet") { if (props.name === "WebTablet Tablet") {

View file

@ -7,7 +7,7 @@
/* global module, Camera, HMD, MyAvatar, controllerDispatcherPlugins:true, Quat, Vec3, Overlays, Xform, /* global module, Camera, HMD, MyAvatar, controllerDispatcherPlugins:true, Quat, Vec3, Overlays, Xform,
MSECS_PER_SEC:true , LEFT_HAND:true, RIGHT_HAND:true, NULL_UUID:true, AVATAR_SELF_ID:true, FORBIDDEN_GRAB_TYPES:true, MSECS_PER_SEC:true , LEFT_HAND:true, RIGHT_HAND:true, FORBIDDEN_GRAB_TYPES:true,
HAPTIC_PULSE_STRENGTH:true, HAPTIC_PULSE_DURATION:true, ZERO_VEC:true, ONE_VEC:true, HAPTIC_PULSE_STRENGTH:true, HAPTIC_PULSE_DURATION:true, ZERO_VEC:true, ONE_VEC:true,
DEFAULT_REGISTRATION_POINT:true, INCHES_TO_METERS:true, DEFAULT_REGISTRATION_POINT:true, INCHES_TO_METERS:true,
TRIGGER_OFF_VALUE:true, TRIGGER_OFF_VALUE:true,
@ -60,9 +60,6 @@ ONE_VEC = { x: 1, y: 1, z: 1 };
LEFT_HAND = 0; LEFT_HAND = 0;
RIGHT_HAND = 1; RIGHT_HAND = 1;
NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
AVATAR_SELF_ID = "{00000000-0000-0000-0000-000000000001}";
FORBIDDEN_GRAB_TYPES = ["Unknown", "Light", "PolyLine", "Zone"]; FORBIDDEN_GRAB_TYPES = ["Unknown", "Light", "PolyLine", "Zone"];
HAPTIC_PULSE_STRENGTH = 1.0; HAPTIC_PULSE_STRENGTH = 1.0;
@ -284,7 +281,7 @@ ensureDynamic = function (entityID) {
// if we distance hold something and keep it very still before releasing it, it ends up // if we distance hold something and keep it very still before releasing it, it ends up
// non-dynamic in bullet. If it's too still, give it a little bounce so it will fall. // non-dynamic in bullet. If it's too still, give it a little bounce so it will fall.
var props = Entities.getEntityProperties(entityID, ["velocity", "dynamic", "parentID"]); var props = Entities.getEntityProperties(entityID, ["velocity", "dynamic", "parentID"]);
if (props.dynamic && props.parentID === NULL_UUID) { if (props.dynamic && props.parentID === Uuid.NULL) {
var velocity = props.velocity; var velocity = props.velocity;
if (Vec3.length(velocity) < 0.05) { // see EntityMotionState.cpp DYNAMIC_LINEAR_VELOCITY_THRESHOLD if (Vec3.length(velocity) < 0.05) { // see EntityMotionState.cpp DYNAMIC_LINEAR_VELOCITY_THRESHOLD
velocity = { x: 0.0, y: 0.2, z: 0.0 }; velocity = { x: 0.0, y: 0.2, z: 0.0 };
@ -295,7 +292,7 @@ ensureDynamic = function (entityID) {
findGroupParent = function (controllerData, targetProps) { findGroupParent = function (controllerData, targetProps) {
while (targetProps.parentID && while (targetProps.parentID &&
targetProps.parentID !== NULL_UUID && targetProps.parentID !== Uuid.NULL &&
Entities.getNestableType(targetProps.parentID) == "entity") { Entities.getNestableType(targetProps.parentID) == "entity") {
var parentProps = Entities.getEntityProperties(targetProps.parentID, DISPATCHER_PROPERTIES); var parentProps = Entities.getEntityProperties(targetProps.parentID, DISPATCHER_PROPERTIES);
if (!parentProps) { if (!parentProps) {
@ -314,19 +311,19 @@ findHandChildEntities = function(hand) {
// find children of avatar's hand joint // find children of avatar's hand joint
var handJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ? "RightHand" : "LeftHand"); var handJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ? "RightHand" : "LeftHand");
var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, handJointIndex); var children = Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, handJointIndex);
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, handJointIndex)); children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, handJointIndex));
// find children of faux controller joint // find children of faux controller joint
var controllerJointIndex = getControllerJointIndex(hand); var controllerJointIndex = getControllerJointIndex(hand);
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerJointIndex)); children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, controllerJointIndex)); children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, controllerJointIndex));
// find children of faux camera-relative controller joint // find children of faux camera-relative controller joint
var controllerCRJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ? var controllerCRJointIndex = MyAvatar.getJointIndex(hand === RIGHT_HAND ?
"_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" : "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" :
"_CAMERA_RELATIVE_CONTROLLER_LEFTHAND"); "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND");
children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerCRJointIndex)); children = children.concat(Entities.getChildrenIDsOfJoint(MyAvatar.sessionUUID, controllerCRJointIndex));
children = children.concat(Entities.getChildrenIDsOfJoint(AVATAR_SELF_ID, controllerCRJointIndex)); children = children.concat(Entities.getChildrenIDsOfJoint(Uuid.SELF, controllerCRJointIndex));
return children.filter(function (childID) { return children.filter(function (childID) {
var childType = Entities.getNestableType(childID); var childType = Entities.getNestableType(childID);

View file

@ -118,20 +118,12 @@ CameraManager = function() {
that.targetYaw = 0; that.targetYaw = 0;
that.targetPitch = 0; that.targetPitch = 0;
that.focalPoint = { that.focalPoint = Vec3.ZERO;
x: 0, that.targetFocalPoint = Vec3.ZERO;
y: 0,
z: 0
};
that.targetFocalPoint = {
x: 0,
y: 0,
z: 0
};
easing = false; easing = false;
easingTime = 0; easingTime = 0;
startOrientation = Quat.fromPitchYawRollDegrees(0, 0, 0); startOrientation = Quat.ZERO;
that.previousCameraMode = null; that.previousCameraMode = null;

View file

@ -71,44 +71,16 @@ SelectionManager = (function() {
that.selections = []; that.selections = [];
var listeners = []; var listeners = [];
that.localRotation = Quat.fromPitchYawRollDegrees(0, 0, 0); that.localRotation = Quat.ZERO;
that.localPosition = { that.localPosition = Vec3.ZERO;
x: 0, that.localDimensions = Vec3.ZERO;
y: 0, that.localRegistrationPoint = Vec3.HALF;
z: 0
};
that.localDimensions = {
x: 0,
y: 0,
z: 0
};
that.localRegistrationPoint = {
x: 0.5,
y: 0.5,
z: 0.5
};
that.worldRotation = Quat.fromPitchYawRollDegrees(0, 0, 0); that.worldRotation = Quat.ZERO;
that.worldPosition = { that.worldPosition = Vec3.ZERO;
x: 0, that.worldDimensions = Vec3.ZERO;
y: 0, that.worldRegistrationPoint = Vec3.HALF;
z: 0 that.centerPosition = Vec3.ZERO;
};
that.worldDimensions = {
x: 0,
y: 0,
z: 0
};
that.worldRegistrationPoint = {
x: 0.5,
y: 0.5,
z: 0.5
};
that.centerPosition = {
x: 0,
y: 0,
z: 0
};
that.saveProperties = function() { that.saveProperties = function() {
that.savedProperties = {}; that.savedProperties = {};
@ -350,11 +322,7 @@ SelectionDisplay = (function() {
}; };
var grabberLineWidth = 0.5; var grabberLineWidth = 0.5;
var grabberSolid = true; var grabberSolid = true;
var grabberMoveUpPosition = { var grabberMoveUpPosition = Vec3.ZERO;
x: 0,
y: 0,
z: 0
};
var lightOverlayColor = { var lightOverlayColor = {
red: 255, red: 255,
@ -363,11 +331,7 @@ SelectionDisplay = (function() {
}; };
var grabberPropertiesCorner = { var grabberPropertiesCorner = {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: grabberSizeCorner, size: grabberSizeCorner,
color: grabberColorCorner, color: grabberColorCorner,
alpha: 1, alpha: 1,
@ -380,11 +344,7 @@ SelectionDisplay = (function() {
}; };
var grabberPropertiesEdge = { var grabberPropertiesEdge = {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: grabberSizeEdge, size: grabberSizeEdge,
color: grabberColorEdge, color: grabberColorEdge,
alpha: 1, alpha: 1,
@ -397,11 +357,7 @@ SelectionDisplay = (function() {
}; };
var grabberPropertiesFace = { var grabberPropertiesFace = {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: grabberSizeFace, size: grabberSizeFace,
color: grabberColorFace, color: grabberColorFace,
alpha: 1, alpha: 1,
@ -414,11 +370,7 @@ SelectionDisplay = (function() {
}; };
var grabberPropertiesCloner = { var grabberPropertiesCloner = {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: grabberSizeCorner, size: grabberSizeCorner,
color: grabberColorCloner, color: grabberColorCloner,
alpha: 1, alpha: 1,
@ -436,11 +388,7 @@ SelectionDisplay = (function() {
}; };
var highlightBox = Overlays.addOverlay("cube", { var highlightBox = Overlays.addOverlay("cube", {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: 1, size: 1,
color: { color: {
red: 90, red: 90,
@ -457,11 +405,7 @@ SelectionDisplay = (function() {
}); });
var selectionBox = Overlays.addOverlay("cube", { var selectionBox = Overlays.addOverlay("cube", {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: 1, size: 1,
color: { color: {
red: 255, red: 255,
@ -478,11 +422,7 @@ SelectionDisplay = (function() {
var selectionBoxes = []; var selectionBoxes = [];
var rotationDegreesDisplay = Overlays.addOverlay("text3d", { var rotationDegreesDisplay = Overlays.addOverlay("text3d", {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
text: "", text: "",
color: { color: {
red: 0, red: 0,
@ -513,11 +453,7 @@ SelectionDisplay = (function() {
var grabberMoveUp = Overlays.addOverlay("image3d", { var grabberMoveUp = Overlays.addOverlay("image3d", {
url: HIFI_PUBLIC_BUCKET + "images/up-arrow.svg", url: HIFI_PUBLIC_BUCKET + "images/up-arrow.svg",
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
color: handleColor, color: handleColor,
alpha: handleAlpha, alpha: handleAlpha,
visible: false, visible: false,
@ -720,16 +656,8 @@ SelectionDisplay = (function() {
var xRailOverlay = Overlays.addOverlay("line3d", { var xRailOverlay = Overlays.addOverlay("line3d", {
visible: false, visible: false,
lineWidth: 1.0, lineWidth: 1.0,
start: { start: Vec3.ZERO,
x: 0, end: Vec3.ZERO,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
color: { color: {
red: 255, red: 255,
green: 0, green: 0,
@ -740,16 +668,8 @@ SelectionDisplay = (function() {
var yRailOverlay = Overlays.addOverlay("line3d", { var yRailOverlay = Overlays.addOverlay("line3d", {
visible: false, visible: false,
lineWidth: 1.0, lineWidth: 1.0,
start: { start: Vec3.ZERO,
x: 0, end: Vec3.ZERO,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
color: { color: {
red: 0, red: 0,
green: 255, green: 255,
@ -760,16 +680,8 @@ SelectionDisplay = (function() {
var zRailOverlay = Overlays.addOverlay("line3d", { var zRailOverlay = Overlays.addOverlay("line3d", {
visible: false, visible: false,
lineWidth: 1.0, lineWidth: 1.0,
start: { start: Vec3.ZERO,
x: 0, end: Vec3.ZERO,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
color: { color: {
red: 0, red: 0,
green: 0, green: 0,
@ -781,16 +693,8 @@ SelectionDisplay = (function() {
var rotateZeroOverlay = Overlays.addOverlay("line3d", { var rotateZeroOverlay = Overlays.addOverlay("line3d", {
visible: false, visible: false,
lineWidth: 2.0, lineWidth: 2.0,
start: { start: Vec3.ZERO,
x: 0, end: Vec3.ZERO,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
color: { color: {
red: 255, red: 255,
green: 0, green: 0,
@ -802,16 +706,8 @@ SelectionDisplay = (function() {
var rotateCurrentOverlay = Overlays.addOverlay("line3d", { var rotateCurrentOverlay = Overlays.addOverlay("line3d", {
visible: false, visible: false,
lineWidth: 2.0, lineWidth: 2.0,
start: { start: Vec3.ZERO,
x: 0, end: Vec3.ZERO,
y: 0,
z: 0
},
end: {
x: 0,
y: 0,
z: 0
},
color: { color: {
red: 0, red: 0,
green: 0, green: 0,
@ -822,11 +718,7 @@ SelectionDisplay = (function() {
var rotateOverlayInner = Overlays.addOverlay("circle3d", { var rotateOverlayInner = Overlays.addOverlay("circle3d", {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: 1, size: 1,
color: { color: {
red: 51, red: 51,
@ -856,11 +748,7 @@ SelectionDisplay = (function() {
}); });
var rotateOverlayOuter = Overlays.addOverlay("circle3d", { var rotateOverlayOuter = Overlays.addOverlay("circle3d", {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: 1, size: 1,
color: { color: {
red: 51, red: 51,
@ -891,11 +779,7 @@ SelectionDisplay = (function() {
}); });
var rotateOverlayCurrent = Overlays.addOverlay("circle3d", { var rotateOverlayCurrent = Overlays.addOverlay("circle3d", {
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
size: 1, size: 1,
color: { color: {
red: 224, red: 224,
@ -922,11 +806,7 @@ SelectionDisplay = (function() {
var yawHandle = Overlays.addOverlay("image3d", { var yawHandle = Overlays.addOverlay("image3d", {
url: ROTATE_ARROW_WEST_NORTH_URL, url: ROTATE_ARROW_WEST_NORTH_URL,
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
color: handleColor, color: handleColor,
alpha: handleAlpha, alpha: handleAlpha,
visible: false, visible: false,
@ -939,11 +819,7 @@ SelectionDisplay = (function() {
var pitchHandle = Overlays.addOverlay("image3d", { var pitchHandle = Overlays.addOverlay("image3d", {
url: ROTATE_ARROW_WEST_NORTH_URL, url: ROTATE_ARROW_WEST_NORTH_URL,
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
color: handleColor, color: handleColor,
alpha: handleAlpha, alpha: handleAlpha,
visible: false, visible: false,
@ -956,11 +832,7 @@ SelectionDisplay = (function() {
var rollHandle = Overlays.addOverlay("image3d", { var rollHandle = Overlays.addOverlay("image3d", {
url: ROTATE_ARROW_WEST_NORTH_URL, url: ROTATE_ARROW_WEST_NORTH_URL,
position: { position: Vec3.ZERO,
x: 0,
y: 0,
z: 0
},
color: handleColor, color: handleColor,
alpha: handleAlpha, alpha: handleAlpha,
visible: false, visible: false,
@ -1636,7 +1508,7 @@ SelectionDisplay = (function() {
position = SelectionManager.localPosition; position = SelectionManager.localPosition;
registrationPoint = SelectionManager.localRegistrationPoint; registrationPoint = SelectionManager.localRegistrationPoint;
} else { } else {
rotation = Quat.fromPitchYawRollDegrees(0, 0, 0); rotation = Quat.ZERO;
dimensions = SelectionManager.worldDimensions; dimensions = SelectionManager.worldDimensions;
position = SelectionManager.worldPosition; position = SelectionManager.worldPosition;
registrationPoint = SelectionManager.worldRegistrationPoint; registrationPoint = SelectionManager.worldRegistrationPoint;
@ -2692,7 +2564,7 @@ SelectionDisplay = (function() {
var onBegin = function(event, pickRay, pickResult) { var onBegin = function(event, pickRay, pickResult) {
var properties = Entities.getEntityProperties(SelectionManager.selections[0]); var properties = Entities.getEntityProperties(SelectionManager.selections[0]);
initialProperties = properties; initialProperties = properties;
rotation = (spaceMode === SPACE_LOCAL) ? properties.rotation : Quat.fromPitchYawRollDegrees(0, 0, 0); rotation = (spaceMode === SPACE_LOCAL) ? properties.rotation : Quat.ZERO;
if (spaceMode === SPACE_LOCAL) { if (spaceMode === SPACE_LOCAL) {
rotation = SelectionManager.localRotation; rotation = SelectionManager.localRotation;

View file

@ -18,7 +18,7 @@ OverlayGroup = function(opts) {
var overlays = {}; var overlays = {};
var rootPosition = opts.position || { x: 0, y: 0, z: 0 }; var rootPosition = opts.position || { x: 0, y: 0, z: 0 };
var rootRotation = opts.rotation || Quat.fromPitchYawRollRadians(0, 0, 0); var rootRotation = opts.rotation || Quat.ZERO;
var visible = opts.visible == true; var visible = opts.visible == true;
function updateOverlays() { function updateOverlays() {
@ -36,7 +36,7 @@ OverlayGroup = function(opts) {
that.createOverlay = function(type, properties) { that.createOverlay = function(type, properties) {
properties.position = properties.position || { x: 0, y: 0, z: 0 }; properties.position = properties.position || { x: 0, y: 0, z: 0 };
properties.rotation = properties.rotation || Quat.fromPitchYawRollRadians(0, 0, 0); properties.rotation = properties.rotation || Quat.ZERO;
var overlay = Overlays.addOverlay(type, properties); var overlay = Overlays.addOverlay(type, properties);

View file

@ -6,28 +6,28 @@
// 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, Controller, RIGHT_HAND, LEFT_HAND,
controllerDispatcher.NULL_UUID, enableDispatcherModule, disableDispatcherModule, makeRunningValues, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, controllerDispatcher.ZERO_VEC, Messages, Quat, Vec3, getControllerWorldLocation, makeDispatcherModuleParameters, Overlays, controllerDispatcher.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
*/ */
var controllerDispatcher = Script.require("/~/system/libraries/controllerDispatcherUtils.js"); var controllerDispatcher = Script.require("/~/system/libraries/controllerDispatcherUtils.js");
function touchTargetHasKeyboardFocus(touchTarget) { function touchTargetHasKeyboardFocus(touchTarget) {
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
return Entities.keyboardFocusEntity === touchTarget.entityID; return Entities.keyboardFocusEntity === touchTarget.entityID;
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
return Overlays.keyboardFocusOverlay === touchTarget.overlayID; return Overlays.keyboardFocusOverlay === touchTarget.overlayID;
} }
} }
function setKeyboardFocusOnTouchTarget(touchTarget) { function setKeyboardFocusOnTouchTarget(touchTarget) {
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID && if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL &&
Entities.wantsHandControllerPointerEvents(touchTarget.entityID)) { Entities.wantsHandControllerPointerEvents(touchTarget.entityID)) {
Overlays.keyboardFocusOverlay = controllerDispatcher.NULL_UUID; Overlays.keyboardFocusOverlay = Uuid.NULL;
Entities.keyboardFocusEntity = touchTarget.entityID; Entities.keyboardFocusEntity = touchTarget.entityID;
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.keyboardFocusOverlay = touchTarget.overlayID; Overlays.keyboardFocusOverlay = touchTarget.overlayID;
Entities.keyboardFocusEntity = controllerDispatcher.NULL_UUID; Entities.keyboardFocusEntity = Uuid.NULL;
} }
} }
@ -42,9 +42,9 @@ function sendHoverEnterEventToTouchTarget(hand, touchTarget) {
button: "None" button: "None"
}; };
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendHoverEnterEntity(touchTarget.entityID, pointerEvent); Entities.sendHoverEnterEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendHoverEnterOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendHoverEnterOverlay(touchTarget.overlayID, pointerEvent);
} }
} }
@ -60,10 +60,10 @@ function sendHoverOverEventToTouchTarget(hand, touchTarget) {
button: "None" button: "None"
}; };
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent); Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoverOverEntity(touchTarget.entityID, pointerEvent); Entities.sendHoverOverEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent);
Overlays.sendHoverOverOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendHoverOverOverlay(touchTarget.overlayID, pointerEvent);
} }
@ -81,10 +81,10 @@ function sendTouchStartEventToTouchTarget(hand, touchTarget) {
isPrimaryHeld: true isPrimaryHeld: true
}; };
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendMousePressOnEntity(touchTarget.entityID, pointerEvent); Entities.sendMousePressOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendClickDownOnEntity(touchTarget.entityID, pointerEvent); Entities.sendClickDownOnEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendMousePressOnOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendMousePressOnOverlay(touchTarget.overlayID, pointerEvent);
} }
} }
@ -100,11 +100,11 @@ function sendTouchEndEventToTouchTarget(hand, touchTarget) {
button: "Primary" button: "Primary"
}; };
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendMouseReleaseOnEntity(touchTarget.entityID, pointerEvent); Entities.sendMouseReleaseOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendClickReleaseOnEntity(touchTarget.entityID, pointerEvent); Entities.sendClickReleaseOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoverLeaveEntity(touchTarget.entityID, pointerEvent); Entities.sendHoverLeaveEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendMouseReleaseOnOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendMouseReleaseOnOverlay(touchTarget.overlayID, pointerEvent);
} }
} }
@ -121,10 +121,10 @@ function sendTouchMoveEventToTouchTarget(hand, touchTarget) {
isPrimaryHeld: true isPrimaryHeld: true
}; };
if (touchTarget.entityID && touchTarget.entityID !== controllerDispatcher.NULL_UUID) { if (touchTarget.entityID && touchTarget.entityID !== Uuid.NULL) {
Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent); Entities.sendMouseMoveOnEntity(touchTarget.entityID, pointerEvent);
Entities.sendHoldingClickOnEntity(touchTarget.entityID, pointerEvent); Entities.sendHoldingClickOnEntity(touchTarget.entityID, pointerEvent);
} else if (touchTarget.overlayID && touchTarget.overlayID !== controllerDispatcher.NULL_UUID) { } else if (touchTarget.overlayID && touchTarget.overlayID !== Uuid.NULL) {
Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent); Overlays.sendMouseMoveOnOverlay(touchTarget.overlayID, pointerEvent);
} }
} }

View file

@ -13,7 +13,6 @@
// 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
const CLIENTONLY = false; const CLIENTONLY = false;
const NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
const ENTITY_CHECK_INTERVAL = 5000; // ms = 5 seconds const ENTITY_CHECK_INTERVAL = 5000; // ms = 5 seconds
const STARTUP_DELAY = 2000; // ms = 2 second const STARTUP_DELAY = 2000; // ms = 2 second
const OLD_AGE = 3500; // we recreate the entity if older than this time in seconds const OLD_AGE = 3500; // we recreate the entity if older than this time in seconds
@ -24,7 +23,7 @@ const SIZE_Y = 0.075;
const LETTER_OFFSET = 0.03; // arbitrary value to dynamically change width, could be more accurate by detecting characters const LETTER_OFFSET = 0.03; // arbitrary value to dynamically change width, could be more accurate by detecting characters
const LINE_HEIGHT = 0.05; const LINE_HEIGHT = 0.05;
var nameTagEntityID = NULL_UUID; var nameTagEntityID = Uuid.NULL;
var lastCheckForEntity = 0; var lastCheckForEntity = 0;
// create the name tag entity after a brief delay // create the name tag entity after a brief delay
@ -62,9 +61,9 @@ function updateNameTag() {
}; };
function deleteNameTag() { function deleteNameTag() {
if(nameTagEntityID !== NULL_UUID) { if(nameTagEntityID !== Uuid.NULL) {
Entities.deleteEntity(nameTagEntityID); Entities.deleteEntity(nameTagEntityID);
nameTagEntityID = NULL_UUID; nameTagEntityID = Uuid.NULL;
} }
} }
@ -85,7 +84,7 @@ function cleanup() {
Script.update.connect(update); Script.update.connect(update);
function update() { function update() {
// if no entity we return // if no entity we return
if(nameTagEntityID == NULL_UUID) { if(nameTagEntityID == Uuid.NULL) {
return; return;
} }

View file

@ -14,7 +14,6 @@
// 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
var NULL_UUID = "{00000000-0000-0000-0000-000000000000}";
var LIFETIME = 3600; var LIFETIME = 3600;
var BALL_SIZE = 0.175; var BALL_SIZE = 0.175;
var BALL_DAMPING = 0.5; var BALL_DAMPING = 0.5;