From d20d594ae5b01420b48630bef3da89322bc29079 Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 31 May 2018 10:50:54 -0700 Subject: [PATCH 1/9] use setCollisionEnabled for avatar collisions --- scripts/system/libraries/entitySelectionTool.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index d03d4477f7..cb5d510598 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -313,8 +313,6 @@ SelectionDisplay = (function() { var CTRL_KEY_CODE = 16777249; - var AVATAR_COLLISIONS_OPTION = "Enable Avatar Collisions"; - var TRANSLATE_DIRECTION = { X : 0, Y : 1, @@ -1811,7 +1809,7 @@ SelectionDisplay = (function() { that.restoreAvatarCollisionsFromStretch = function() { if (handleStretchCollisionOverride) { - Menu.setIsOptionChecked(AVATAR_COLLISIONS_OPTION, true); + MyAvatar.setCollisionsEnabled(true); handleStretchCollisionOverride = false; } } @@ -2018,8 +2016,8 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - if (Menu.isOptionChecked(AVATAR_COLLISIONS_OPTION)) { - Menu.setIsOptionChecked(AVATAR_COLLISIONS_OPTION, false); + if (MyAvatar.getCollisionsEnabled()) { + MyAvatar.setCollisionsEnabled(false); handleStretchCollisionOverride = true; } }; From cde111d6012476acd4bd66655efedc1f415cf46a Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 12 Jun 2018 17:55:04 -0700 Subject: [PATCH 2/9] remove pointing at system overlay and overlay at point checks --- scripts/system/libraries/entitySelectionTool.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 1b41559160..3f9c331b47 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -667,9 +667,6 @@ SelectionDisplay = (function() { activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand; } - if (Reticle.pointingAtSystemOverlay || Overlays.getOverlayAtPoint(Reticle.position)) { - return; - } that.mousePressEvent({}); } else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) { that.triggered = false; From 9b33e6757f6d33a2057d4b0bfc88a1406bf97599 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 14:29:47 -0700 Subject: [PATCH 3/9] prevent edit press events when pointing at desktop window or tablet --- .../controllerModules/inEditMode.js | 34 +++++++++++++++++++ .../system/libraries/entitySelectionTool.js | 24 ++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index 5d90898b82..d0c2f94f85 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -18,10 +18,16 @@ Script.include("/~/system/libraries/controllers.js"); Script.include("/~/system/libraries/utils.js"); (function () { + var MARGIN = 25; + function InEditMode(hand) { this.hand = hand; this.triggerClicked = false; this.selectedTarget = null; + this.reticleMinX = MARGIN; + this.reticleMaxX; + this.reticleMinY = MARGIN; + this.reticleMaxY; this.parameters = makeDispatcherModuleParameters( 160, @@ -47,6 +53,16 @@ Script.include("/~/system/libraries/utils.js"); return (HMD.tabletScreenID && objectID === HMD.tabletScreenID) || (HMD.homeButtonID && objectID === HMD.homeButtonID); }; + + this.calculateNewReticlePosition = function(intersection) { + var dims = Controller.getViewportDimensions(); + this.reticleMaxX = dims.x - MARGIN; + this.reticleMaxY = dims.y - MARGIN; + var point2d = HMD.overlayFromWorldPoint(intersection); + point2d.x = Math.max(this.reticleMinX, Math.min(point2d.x, this.reticleMaxX)); + point2d.y = Math.max(this.reticleMinY, Math.min(point2d.y, this.reticleMaxY)); + return point2d; + }; this.sendPickData = function(controllerData) { if (controllerData.triggerClicks[this.hand]) { @@ -72,7 +88,24 @@ Script.include("/~/system/libraries/utils.js"); this.triggerClicked = true; } + + this.sendPointingAtData(controllerData); }; + + this.sendPointingAtData = function(controllerData) { + var rayPick = controllerData.rayPicks[this.hand]; + var hudRayPick = controllerData.hudRayPicks[this.hand]; + var point2d = this.calculateNewReticlePosition(hudRayPick.intersection); + var desktopWindow = Window.isPointOnDesktopWindow(point2d); + var tablet = this.pointingAtTablet(rayPick.objectID); + var rightHand = this.hand === RIGHT_HAND; + Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ + method: "pointingAt", + desktopWindow: desktopWindow, + tablet: tablet, + rightHand: rightHand + })); + }; this.exitModule = function() { return makeRunningValues(false, [], []); @@ -104,6 +137,7 @@ Script.include("/~/system/libraries/utils.js"); if (overlayLaser) { var overlayLaserReady = overlayLaser.isReady(controllerData); var target = controllerData.rayPicks[this.hand].objectID; + this.sendPointingAtData(controllerData); if (overlayLaserReady.active && this.pointingAtTablet(target)) { return this.exitModule(); } diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 3f9c331b47..35ea579824 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -58,6 +58,14 @@ SelectionManager = (function() { that.setSelections([messageParsed.entityID]); } else if (messageParsed.method === "clearSelection") { that.clearSelections(); + } else if (messageParsed.method === "pointingAt") { + if (messageParsed.rightHand) { + that.pointingAtDesktopWindowRight = messageParsed.desktopWindow; + that.pointingAtTabletRight = messageParsed.tablet; + } else { + that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow; + that.pointingAtTabletLeft = messageParsed.tablet; + } } } @@ -93,6 +101,11 @@ SelectionManager = (function() { that.worldDimensions = Vec3.ZERO; that.worldRegistrationPoint = Vec3.HALF; that.centerPosition = Vec3.ZERO; + + that.pointingAtDesktopWindowLeft = false; + that.pointingAtDesktopWindowRight = false; + that.pointingAtTabletLeft = false; + that.pointingAtTabletRight = false; that.saveProperties = function() { that.savedProperties = {}; @@ -667,7 +680,16 @@ SelectionDisplay = (function() { activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand; } - that.mousePressEvent({}); + var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && + SelectionManager.pointingAtDesktopWindowRight) || + (hand === Controller.Standard.LeftHand && + SelectionManager.pointingAtDesktopWindowLeft); + var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || + (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); + if (pointingAtDesktopWindow || pointingAtTablet) { + return; + } + that.mousePressEvent({}); } else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) { that.triggered = false; that.mouseReleaseEvent({}); From bc06b88afc49cb6074296046a7e5e584f7e4afda Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 14:31:18 -0700 Subject: [PATCH 4/9] tabs --- .../controllerModules/inEditMode.js | 42 +++++++++---------- .../system/libraries/entitySelectionTool.js | 40 +++++++++--------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index d0c2f94f85..a724c2037b 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -18,13 +18,13 @@ Script.include("/~/system/libraries/controllers.js"); Script.include("/~/system/libraries/utils.js"); (function () { - var MARGIN = 25; - + var MARGIN = 25; + function InEditMode(hand) { this.hand = hand; this.triggerClicked = false; this.selectedTarget = null; - this.reticleMinX = MARGIN; + this.reticleMinX = MARGIN; this.reticleMaxX; this.reticleMinY = MARGIN; this.reticleMaxY; @@ -53,7 +53,7 @@ Script.include("/~/system/libraries/utils.js"); return (HMD.tabletScreenID && objectID === HMD.tabletScreenID) || (HMD.homeButtonID && objectID === HMD.homeButtonID); }; - + this.calculateNewReticlePosition = function(intersection) { var dims = Controller.getViewportDimensions(); this.reticleMaxX = dims.x - MARGIN; @@ -88,24 +88,24 @@ Script.include("/~/system/libraries/utils.js"); this.triggerClicked = true; } - - this.sendPointingAtData(controllerData); + + this.sendPointingAtData(controllerData); }; - - this.sendPointingAtData = function(controllerData) { - var rayPick = controllerData.rayPicks[this.hand]; - var hudRayPick = controllerData.hudRayPicks[this.hand]; - var point2d = this.calculateNewReticlePosition(hudRayPick.intersection); - var desktopWindow = Window.isPointOnDesktopWindow(point2d); - var tablet = this.pointingAtTablet(rayPick.objectID); - var rightHand = this.hand === RIGHT_HAND; - Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ - method: "pointingAt", - desktopWindow: desktopWindow, - tablet: tablet, - rightHand: rightHand + + this.sendPointingAtData = function(controllerData) { + var rayPick = controllerData.rayPicks[this.hand]; + var hudRayPick = controllerData.hudRayPicks[this.hand]; + var point2d = this.calculateNewReticlePosition(hudRayPick.intersection); + var desktopWindow = Window.isPointOnDesktopWindow(point2d); + var tablet = this.pointingAtTablet(rayPick.objectID); + var rightHand = this.hand === RIGHT_HAND; + Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ + method: "pointingAt", + desktopWindow: desktopWindow, + tablet: tablet, + rightHand: rightHand })); - }; + }; this.exitModule = function() { return makeRunningValues(false, [], []); @@ -137,7 +137,7 @@ Script.include("/~/system/libraries/utils.js"); if (overlayLaser) { var overlayLaserReady = overlayLaser.isReady(controllerData); var target = controllerData.rayPicks[this.hand].objectID; - this.sendPointingAtData(controllerData); + this.sendPointingAtData(controllerData); if (overlayLaserReady.active && this.pointingAtTablet(target)) { return this.exitModule(); } diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 35ea579824..5769e4fded 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -59,13 +59,13 @@ SelectionManager = (function() { } else if (messageParsed.method === "clearSelection") { that.clearSelections(); } else if (messageParsed.method === "pointingAt") { - if (messageParsed.rightHand) { - that.pointingAtDesktopWindowRight = messageParsed.desktopWindow; - that.pointingAtTabletRight = messageParsed.tablet; - } else { - that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow; - that.pointingAtTabletLeft = messageParsed.tablet; - } + if (messageParsed.rightHand) { + that.pointingAtDesktopWindowRight = messageParsed.desktopWindow; + that.pointingAtTabletRight = messageParsed.tablet; + } else { + that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow; + that.pointingAtTabletLeft = messageParsed.tablet; + } } } @@ -101,11 +101,11 @@ SelectionManager = (function() { that.worldDimensions = Vec3.ZERO; that.worldRegistrationPoint = Vec3.HALF; that.centerPosition = Vec3.ZERO; - - that.pointingAtDesktopWindowLeft = false; - that.pointingAtDesktopWindowRight = false; - that.pointingAtTabletLeft = false; - that.pointingAtTabletRight = false; + + that.pointingAtDesktopWindowLeft = false; + that.pointingAtDesktopWindowRight = false; + that.pointingAtTabletLeft = false; + that.pointingAtTabletRight = false; that.saveProperties = function() { that.savedProperties = {}; @@ -680,16 +680,16 @@ SelectionDisplay = (function() { activeHand = (activeHand === Controller.Standard.RightHand) ? Controller.Standard.LeftHand : Controller.Standard.RightHand; } - var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && - SelectionManager.pointingAtDesktopWindowRight) || - (hand === Controller.Standard.LeftHand && - SelectionManager.pointingAtDesktopWindowLeft); - var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || - (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); + var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && + SelectionManager.pointingAtDesktopWindowRight) || + (hand === Controller.Standard.LeftHand && + SelectionManager.pointingAtDesktopWindowLeft); + var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || + (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); if (pointingAtDesktopWindow || pointingAtTablet) { - return; + return; } - that.mousePressEvent({}); + that.mousePressEvent({}); } else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) { that.triggered = false; that.mouseReleaseEvent({}); From f6c624dcc3ad96f8e65b6a83f89c484b7f0b65e5 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 15 Jun 2018 16:31:09 -0700 Subject: [PATCH 5/9] Remove logging messages for behaviors that are expected. Attached entities with scripts are now being sold on the marketplace (rWatch) and are now being worn by various users. Because of this, it's now common for the 'removing entity scripts' case to be hit in code for every update, which causes debug log messages every 60 seconds for each entity entity with a script. Repro: Have an avatar wear rWatch. With a second instance of interface, turn on verbose logging while the first avatar is local. See debug logging 60 times a second. Fix: Given attached entities with scripts are happening, it's not an exceptional case and should probably not be logged. --- libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 048b8b1633..c257349bff 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -294,7 +294,6 @@ void Avatar::updateAvatarEntities() { // NOTE: if this avatar entity is not attached to us, strip its entity script completely... auto attachedScript = properties.getScript(); if (!isMyAvatar() && !attachedScript.isEmpty()) { - qCDebug(avatars_renderer) << "removing entity script from avatar attached entity:" << entityID << "old script:" << attachedScript; QString noScript; properties.setScript(noScript); } From 6ef8206f3aeb913f14d9ffa164d97b8441d7313a Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 17:32:03 -0700 Subject: [PATCH 6/9] temp disable myAvatar collisions when stretching --- .../system/libraries/entitySelectionTool.js | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index b42ed5cf64..48c8c68f96 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -366,7 +366,7 @@ SelectionDisplay = (function() { var ctrlPressed = false; - var handleStretchCollisionOverride = false; + var replaceCollisionsAfterStretch = false; var handlePropertiesTranslateArrowCones = { shape: "Cone", @@ -642,11 +642,6 @@ SelectionDisplay = (function() { var activeTool = null; var handleTools = {}; - that.shutdown = function() { - that.restoreAvatarCollisionsFromStretch(); - } - Script.scriptEnding.connect(that.shutdown); - // We get mouseMoveEvents from the handControllers, via handControllerPointer. // But we dont' get mousePressEvents. that.triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click'); @@ -1830,13 +1825,6 @@ SelectionDisplay = (function() { }; }; - that.restoreAvatarCollisionsFromStretch = function() { - if (handleStretchCollisionOverride) { - MyAvatar.setCollisionsEnabled(true); - handleStretchCollisionOverride = false; - } - } - // TOOL DEFINITION: HANDLE STRETCH TOOL function makeStretchTool(stretchMode, directionEnum, directionVec, pivot, offset, stretchPanel, scaleHandle) { var directionFor3DStretch = directionVec; @@ -2039,10 +2027,13 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - if (MyAvatar.getCollisionsEnabled()) { - MyAvatar.setCollisionsEnabled(false); - handleStretchCollisionOverride = true; - } + + var myAvatarIndex = properties.collidesWith.indexOf("myAvatar"); + if (myAvatarIndex > -1) { + var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); + Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); + that.replaceCollisionsAfterStretch = true; + } }; var onEnd = function(event, reason) { @@ -2052,7 +2043,13 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE }); } - that.restoreAvatarCollisionsFromStretch(); + + if (that.replaceCollisionsAfterStretch) { + var newCollidesWith = SelectionManager.savedProperties[SelectionManager.selections[0]].collidesWith; + Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); + that.replaceCollisionsAfterStretch = false; + } + pushCommandForSelections(); }; @@ -2138,12 +2135,10 @@ SelectionDisplay = (function() { } var newPosition = Vec3.sum(initialPosition, changeInPosition); - for (var i = 0; i < SelectionManager.selections.length; i++) { - Entities.editEntity(SelectionManager.selections[i], { - position: newPosition, - dimensions: newDimensions - }); - } + Entities.editEntity(SelectionManager.selections[0], { + position: newPosition, + dimensions: newDimensions + }); var wantDebug = false; if (wantDebug) { From d16b7779779ad232d56e989a33a33e0f18923134 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 17:33:49 -0700 Subject: [PATCH 7/9] tabs --- .../system/libraries/entitySelectionTool.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 48c8c68f96..9da0e813d1 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2027,13 +2027,13 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - - var myAvatarIndex = properties.collidesWith.indexOf("myAvatar"); - if (myAvatarIndex > -1) { - var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); - Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); - that.replaceCollisionsAfterStretch = true; - } + + var myAvatarIndex = properties.collidesWith.indexOf("myAvatar"); + if (myAvatarIndex > -1) { + var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); + Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); + that.replaceCollisionsAfterStretch = true; + } }; var onEnd = function(event, reason) { @@ -2043,13 +2043,13 @@ SelectionDisplay = (function() { if (scaleHandle != null) { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE }); } - - if (that.replaceCollisionsAfterStretch) { - var newCollidesWith = SelectionManager.savedProperties[SelectionManager.selections[0]].collidesWith; - Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); - that.replaceCollisionsAfterStretch = false; - } - + + if (that.replaceCollisionsAfterStretch) { + var newCollidesWith = SelectionManager.savedProperties[SelectionManager.selections[0]].collidesWith; + Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); + that.replaceCollisionsAfterStretch = false; + } + pushCommandForSelections(); }; @@ -2135,7 +2135,7 @@ SelectionDisplay = (function() { } var newPosition = Vec3.sum(initialPosition, changeInPosition); - Entities.editEntity(SelectionManager.selections[0], { + Entities.editEntity(SelectionManager.selections[0], { position: newPosition, dimensions: newDimensions }); From bb0b1cc4a4589b77be588754a0314f14bf2dd1cc Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 15 Jun 2018 17:35:18 -0700 Subject: [PATCH 8/9] no myAvatarIndex needed --- scripts/system/libraries/entitySelectionTool.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 9da0e813d1..8b1c50b129 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2028,8 +2028,7 @@ SelectionDisplay = (function() { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - var myAvatarIndex = properties.collidesWith.indexOf("myAvatar"); - if (myAvatarIndex > -1) { + if (properties.collidesWith.indexOf("myAvatar") > -1) { var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); that.replaceCollisionsAfterStretch = true; From 80adad7965101f2ac5148e7c5529728f54e99067 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 22 Jun 2018 13:52:43 -0700 Subject: [PATCH 9/9] myAvatar constant --- scripts/system/libraries/entitySelectionTool.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 8b1c50b129..a5a28fb206 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2028,8 +2028,9 @@ SelectionDisplay = (function() { Overlays.editOverlay(scaleHandle, { color: COLOR_SCALE_CUBE_SELECTED }); } - if (properties.collidesWith.indexOf("myAvatar") > -1) { - var newCollidesWith = properties.collidesWith.replace("myAvatar", ""); + var collisionToRemove = "myAvatar"; + if (properties.collidesWith.indexOf(collisionToRemove) > -1) { + var newCollidesWith = properties.collidesWith.replace(collisionToRemove, ""); Entities.editEntity(SelectionManager.selections[0], {collidesWith: newCollidesWith}); that.replaceCollisionsAfterStretch = true; }