From 051616d7c3045d14132ae142453bf3066efc3ad5 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 8 Jul 2016 16:16:06 -0700 Subject: [PATCH 01/18] experimenting --- interface/src/avatar/AvatarActionHold.cpp | 2 +- scripts/system/controllers/handControllerGrab.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index c84cfecb40..1babb478b8 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -168,7 +168,7 @@ bool AvatarActionHold::getTarget(float deltaTimeStep, glm::quat& rotation, glm:: position = palmPosition + rotation * _relativePosition; // update linearVelocity based on offset via _relativePosition; - linearVelocity = linearVelocity + glm::cross(angularVelocity, position - palmPosition); + // linearVelocity = linearVelocity + glm::cross(angularVelocity, position - palmPosition); }); return true; diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 373f203e80..4e4269df28 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -13,7 +13,7 @@ /* global setEntityCustomData, getEntityCustomData, vec3toStr, flatten, Xform */ Script.include("/~/system/libraries/utils.js"); -Script.include("../libraries/Xform.js"); +Script.include("/~/system/libraries/Xform.js"); // // add lines where the hand ray picking is happening From eac144f35476762dfb6d99155320d22a00445b69 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 09:52:24 -0700 Subject: [PATCH 02/18] experimenting --- interface/src/avatar/AvatarActionHold.cpp | 9 ++++++++- interface/src/avatar/AvatarActionHold.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index 1babb478b8..2baaae6ee4 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -204,8 +204,15 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { } withWriteLock([&]{ + if (_previousSet) { + _measuredLinearVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep; + } else { + _measuredLinearVelocity = glm::vec3(); + } + if (_kinematicSetVelocity) { - rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget)); + // rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget)); + rigidBody->setLinearVelocity(glmToBullet(_measuredLinearVelocity)); rigidBody->setAngularVelocity(glmToBullet(_angularVelocityTarget)); } diff --git a/interface/src/avatar/AvatarActionHold.h b/interface/src/avatar/AvatarActionHold.h index 609fd57ff3..e246ac5f36 100644 --- a/interface/src/avatar/AvatarActionHold.h +++ b/interface/src/avatar/AvatarActionHold.h @@ -64,6 +64,8 @@ private: glm::vec3 _palmOffsetFromRigidBody; // leaving this here for future refernece. // glm::quat _palmRotationFromRigidBody; + + glm::vec3 _measuredLinearVelocity; }; #endif // hifi_AvatarActionHold_h From 7295e5c101fe1c0fe06b605f8087d7da53738059 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 10:22:44 -0700 Subject: [PATCH 03/18] experimenting --- interface/src/avatar/AvatarActionHold.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index 2baaae6ee4..d1750ddf53 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -206,6 +206,8 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { withWriteLock([&]{ if (_previousSet) { _measuredLinearVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep; + qDebug() << _measuredLinearVelocity.x << _measuredLinearVelocity.y << _measuredLinearVelocity.z + << deltaTimeStep; } else { _measuredLinearVelocity = glm::vec3(); } From 53a366d4e882c8255aeabc45f8c327f3e9c5671d Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 13:25:00 -0700 Subject: [PATCH 04/18] measure velocity over 6 frames --- interface/src/avatar/AvatarActionHold.cpp | 23 ++++++++++++++++------- interface/src/avatar/AvatarActionHold.h | 4 +++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index d1750ddf53..ce0cf886d5 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -17,11 +17,14 @@ #include "CharacterController.h" const uint16_t AvatarActionHold::holdVersion = 1; +const int AvatarActionHold::velocitySmoothFrames = 6; + AvatarActionHold::AvatarActionHold(const QUuid& id, EntityItemPointer ownerEntity) : ObjectActionSpring(id, ownerEntity) { _type = ACTION_TYPE_HOLD; + _measuredLinearVelocities.resize(AvatarActionHold::velocitySmoothFrames); #if WANT_DEBUG qDebug() << "AvatarActionHold::AvatarActionHold"; #endif @@ -168,7 +171,7 @@ bool AvatarActionHold::getTarget(float deltaTimeStep, glm::quat& rotation, glm:: position = palmPosition + rotation * _relativePosition; // update linearVelocity based on offset via _relativePosition; - // linearVelocity = linearVelocity + glm::cross(angularVelocity, position - palmPosition); + linearVelocity = linearVelocity + glm::cross(angularVelocity, position - palmPosition); }); return true; @@ -205,16 +208,22 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { withWriteLock([&]{ if (_previousSet) { - _measuredLinearVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep; - qDebug() << _measuredLinearVelocity.x << _measuredLinearVelocity.y << _measuredLinearVelocity.z - << deltaTimeStep; - } else { - _measuredLinearVelocity = glm::vec3(); + glm::vec3 oneFrameVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep; + _measuredLinearVelocities[_measuredLinearVelocitiesIndex++] = oneFrameVelocity; + if (_measuredLinearVelocitiesIndex >= AvatarActionHold::velocitySmoothFrames) { + _measuredLinearVelocitiesIndex = 0; + } } + glm::vec3 measuredLinearVelocity; + for (int i = 0; i < AvatarActionHold::velocitySmoothFrames; i++) { + measuredLinearVelocity += _measuredLinearVelocities[i]; + } + measuredLinearVelocity /= (float)AvatarActionHold::velocitySmoothFrames; + if (_kinematicSetVelocity) { // rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget)); - rigidBody->setLinearVelocity(glmToBullet(_measuredLinearVelocity)); + rigidBody->setLinearVelocity(glmToBullet(measuredLinearVelocity)); rigidBody->setAngularVelocity(glmToBullet(_angularVelocityTarget)); } diff --git a/interface/src/avatar/AvatarActionHold.h b/interface/src/avatar/AvatarActionHold.h index e246ac5f36..bfa392172d 100644 --- a/interface/src/avatar/AvatarActionHold.h +++ b/interface/src/avatar/AvatarActionHold.h @@ -65,7 +65,9 @@ private: // leaving this here for future refernece. // glm::quat _palmRotationFromRigidBody; - glm::vec3 _measuredLinearVelocity; + static const int velocitySmoothFrames; + QVector _measuredLinearVelocities; + int _measuredLinearVelocitiesIndex { 0 }; }; #endif // hifi_AvatarActionHold_h From 9c17890035422ecbc0bc0031ecc72f8d6e699c0f Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 14:18:28 -0700 Subject: [PATCH 05/18] try not including the most recent sample in the smoothed velocity --- interface/src/avatar/AvatarActionHold.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index ce0cf886d5..4583813131 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -207,6 +207,15 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { } withWriteLock([&]{ + glm::vec3 measuredLinearVelocity; + // there is a bit of lag between when someone releases the trigger and the software reacts to + // the release. we calculate the velocity from previous frames but not this frame (by having + // this code before where _measuredLinearVelocities is set, below) in order to help mask this. + for (int i = 0; i < AvatarActionHold::velocitySmoothFrames; i++) { + measuredLinearVelocity += _measuredLinearVelocities[i]; + } + measuredLinearVelocity /= (float)AvatarActionHold::velocitySmoothFrames; + if (_previousSet) { glm::vec3 oneFrameVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep; _measuredLinearVelocities[_measuredLinearVelocitiesIndex++] = oneFrameVelocity; @@ -215,12 +224,6 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { } } - glm::vec3 measuredLinearVelocity; - for (int i = 0; i < AvatarActionHold::velocitySmoothFrames; i++) { - measuredLinearVelocity += _measuredLinearVelocities[i]; - } - measuredLinearVelocity /= (float)AvatarActionHold::velocitySmoothFrames; - if (_kinematicSetVelocity) { // rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget)); rigidBody->setLinearVelocity(glmToBullet(measuredLinearVelocity)); From b0f1492ac7b3844fd5440dc9542069bdfe687ea5 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 15:08:00 -0700 Subject: [PATCH 06/18] ignore 3 frames for current velocity rather than just 1 --- interface/src/avatar/AvatarActionHold.cpp | 34 +++++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index 4583813131..3ab81c5462 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -207,15 +207,6 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { } withWriteLock([&]{ - glm::vec3 measuredLinearVelocity; - // there is a bit of lag between when someone releases the trigger and the software reacts to - // the release. we calculate the velocity from previous frames but not this frame (by having - // this code before where _measuredLinearVelocities is set, below) in order to help mask this. - for (int i = 0; i < AvatarActionHold::velocitySmoothFrames; i++) { - measuredLinearVelocity += _measuredLinearVelocities[i]; - } - measuredLinearVelocity /= (float)AvatarActionHold::velocitySmoothFrames; - if (_previousSet) { glm::vec3 oneFrameVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep; _measuredLinearVelocities[_measuredLinearVelocitiesIndex++] = oneFrameVelocity; @@ -224,6 +215,31 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { } } + glm::vec3 measuredLinearVelocity; + for (int i = 0; i < AvatarActionHold::velocitySmoothFrames; i++) { + // there is a bit of lag between when someone releases the trigger and when the software reacts to + // the release. we calculate the velocity from previous frames but we don't include several + // of the most recent. + // + // if _measuredLinearVelocitiesIndex is + // 0 -- ignore i of 3 4 5 + // 1 -- ignore i of 4 5 0 + // 2 -- ignore i of 5 0 1 + // 3 -- ignore i of 0 1 2 + // 4 -- ignore i of 1 2 3 + // 5 -- ignore i of 2 3 4 + if ((i + 1) % 6 == _measuredLinearVelocitiesIndex || + (i + 2) % 6 == _measuredLinearVelocitiesIndex || + (i + 3) % 6 == _measuredLinearVelocitiesIndex) { + continue; + } + + measuredLinearVelocity += _measuredLinearVelocities[i]; + } + measuredLinearVelocity /= (float)AvatarActionHold::velocitySmoothFrames; + + + if (_kinematicSetVelocity) { // rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget)); rigidBody->setLinearVelocity(glmToBullet(measuredLinearVelocity)); From 1ef26d39eb43162f1fe5253841ab5ad56bf79a8c Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 15:31:15 -0700 Subject: [PATCH 07/18] blah --- interface/src/avatar/AvatarActionHold.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index 3ab81c5462..ce623cf604 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -236,7 +236,7 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { measuredLinearVelocity += _measuredLinearVelocities[i]; } - measuredLinearVelocity /= (float)AvatarActionHold::velocitySmoothFrames; + measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 3); From 0d0e0925e5b27f4944bc4cc074cf3e333da49386 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 16:00:55 -0700 Subject: [PATCH 08/18] try skipping 2 rather than 3 --- interface/src/avatar/AvatarActionHold.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index ce623cf604..3bbdf9f099 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -222,21 +222,20 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { // of the most recent. // // if _measuredLinearVelocitiesIndex is - // 0 -- ignore i of 3 4 5 - // 1 -- ignore i of 4 5 0 - // 2 -- ignore i of 5 0 1 - // 3 -- ignore i of 0 1 2 - // 4 -- ignore i of 1 2 3 - // 5 -- ignore i of 2 3 4 + // 0 -- ignore i of 4 5 + // 1 -- ignore i of 5 0 + // 2 -- ignore i of 0 1 + // 3 -- ignore i of 1 2 + // 4 -- ignore i of 2 3 + // 5 -- ignore i of 3 4 if ((i + 1) % 6 == _measuredLinearVelocitiesIndex || - (i + 2) % 6 == _measuredLinearVelocitiesIndex || - (i + 3) % 6 == _measuredLinearVelocitiesIndex) { + (i + 2) % 6 == _measuredLinearVelocitiesIndex) { continue; } measuredLinearVelocity += _measuredLinearVelocities[i]; } - measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 3); + measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 2); From 84c5bef487fe6d16e38c3aa4e8ffd9b6f5802f8a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 17:02:11 -0700 Subject: [PATCH 09/18] back to ignore more recent 3 frames. don't have released entities collide with myAvatar until 0.25 seconds after release --- interface/src/avatar/AvatarActionHold.cpp | 20 ++++++++--------- .../system/controllers/handControllerGrab.js | 22 ++++++++++++++++++- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index 3bbdf9f099..32905361dd 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -222,22 +222,20 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { // of the most recent. // // if _measuredLinearVelocitiesIndex is - // 0 -- ignore i of 4 5 - // 1 -- ignore i of 5 0 - // 2 -- ignore i of 0 1 - // 3 -- ignore i of 1 2 - // 4 -- ignore i of 2 3 - // 5 -- ignore i of 3 4 + // 0 -- ignore i of 3 4 5 + // 1 -- ignore i of 4 5 0 + // 2 -- ignore i of 5 0 1 + // 3 -- ignore i of 0 1 2 + // 4 -- ignore i of 1 2 3 + // 5 -- ignore i of 2 3 4 if ((i + 1) % 6 == _measuredLinearVelocitiesIndex || - (i + 2) % 6 == _measuredLinearVelocitiesIndex) { + (i + 2) % 6 == _measuredLinearVelocitiesIndex || + (i + 3) % 6 == _measuredLinearVelocitiesIndex) { continue; } - measuredLinearVelocity += _measuredLinearVelocities[i]; } - measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 2); - - + measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 3); if (_kinematicSetVelocity) { // rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget)); diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 2cef48290c..36cef8ec2d 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -33,6 +33,8 @@ var TRIGGER_ON_VALUE = 0.4; // Squeezed just enough to activate search or near var TRIGGER_GRAB_VALUE = 0.85; // Squeezed far enough to complete distant grab var TRIGGER_OFF_VALUE = 0.15; +var COLLIDE_WITH_AV_AFTER_RELEASE_DELAY = 0.25; // seconds + var BUMPER_ON_VALUE = 0.5; var THUMB_ON_VALUE = 0.5; @@ -263,6 +265,17 @@ function propsArePhysical(props) { return isPhysical; } +function removeMyAvatarFromCollidesWith(origCollidesWith) { + var collidesWithSplit = origCollidesWith.split(","); + // remove myAvatar from the array + for (var i = collidesWithSplit.length - 1; i >= 0; i--) { + if (collidesWithSplit[i] === "myAvatar") { + collidesWithSplit.splice(i, 1); + } + } + return collidesWithSplit.join(); +} + // If another script is managing the reticle (as is done by HandControllerPointer), we should not be setting it here, // and we should not be showing lasers when someone else is using the Reticle to indicate a 2D minor mode. var EXTERNALLY_MANAGED_2D_MINOR_MODE = true; @@ -2128,13 +2141,20 @@ function MyController(hand) { if (data["refCount"] < 1) { deactiveProps = { gravity: data["gravity"], - collidesWith: data["collidesWith"], + // don't set collidesWith back right away, because thrown things tend to bounce off the + // avatar's capsule. + collidesWith: removeMyAvatarFromCollidesWith(data["collidesWith"]), collisionless: data["collisionless"], dynamic: data["dynamic"], parentID: data["parentID"], parentJointIndex: data["parentJointIndex"] }; + Script.setTimeout(function () { + // set collidesWith back to original value a bit later than the rest + Entities.editEntity(entityID, { collidesWith: data["collidesWith"] }); + }, COLLIDE_WITH_AV_AFTER_RELEASE_DELAY); + // things that are held by parenting and dropped with no velocity will end up as "static" in bullet. If // it looks like the dropped thing should fall, give it a little velocity. var props = Entities.getEntityProperties(entityID, ["parentID", "velocity", "dynamic", "shapeType"]); From 367c26a5eef1ba352ac5178d476b5b85cc5412bd Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 11 Jul 2016 18:53:47 -0700 Subject: [PATCH 10/18] wait a bit before resetting collides-with-my-avatar --- .../system/controllers/handControllerGrab.js | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 36cef8ec2d..aaaa7c5962 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -181,6 +181,10 @@ var COLLIDES_WITH_WHILE_MULTI_GRABBED = "dynamic"; var HEART_BEAT_INTERVAL = 5 * MSECS_PER_SEC; var HEART_BEAT_TIMEOUT = 15 * MSECS_PER_SEC; +var avCollideLater; +var setCollidesLaterTimeout; +var collideLaterID; + var CONTROLLER_STATE_MACHINE = {}; CONTROLLER_STATE_MACHINE[STATE_OFF] = { @@ -2060,6 +2064,17 @@ function MyController(hand) { } this.entityActivated = true; + if (setCollidesLaterTimeout && collideLaterID == entityID) { + // we have a timeout waiting to set collisions with myAvatar back on (so that when something + // is thrown it doesn't collide with the avatar's capsule the moment it's released). We've + // regrabbed the entity before the timeout fired, so cancel the timeout, run the function now + // and adjust the grabbedProperties. This will make the saved set of properties (the ones that + // get re-instated after all the grabs have been released) be correct. + Script.clearTimeout(setCollidesLaterTimeout); + setCollidesLaterTimeout = null; + grabbedProperties["collidesWith"] = avCollideLater(); + } + var data = getEntityCustomData(GRAB_USER_DATA_KEY, entityID, {}); var now = Date.now(); @@ -2150,10 +2165,18 @@ function MyController(hand) { parentJointIndex: data["parentJointIndex"] }; - Script.setTimeout(function () { - // set collidesWith back to original value a bit later than the rest - Entities.editEntity(entityID, { collidesWith: data["collidesWith"] }); - }, COLLIDE_WITH_AV_AFTER_RELEASE_DELAY); + if (data["collidesWith"].indexOf("myAvatar") >= 0) { + var javaScriptScopingIsBrokenData = data; + avCollideLater = function () { + // set collidesWith back to original value a bit later than the rest + _this.setCollidesLaterTimeout = null; + Entities.editEntity(entityID, { collidesWith: javaScriptScopingIsBrokenData["collidesWith"] }); + return javaScriptScopingIsBrokenData["collidesWith"]; + } + setCollidesLaterTimeout = + Script.setTimeout(avCollideLater, COLLIDE_WITH_AV_AFTER_RELEASE_DELAY * MSECS_PER_SEC); + collideLaterID = entityID; + } // things that are held by parenting and dropped with no velocity will end up as "static" in bullet. If // it looks like the dropped thing should fall, give it a little velocity. From 19991939073353002b098df01a6d193e67890832 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 12 Jul 2016 11:42:58 -0700 Subject: [PATCH 11/18] split the grab script's deactivation on an entity into two parts -- one that happens during release and a delayed part which finishes up. This makes collisions with a thrower's capsule less likely --- .../system/controllers/handControllerGrab.js | 65 +++++++++++++------ 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index aaaa7c5962..ac903190c4 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -181,9 +181,9 @@ var COLLIDES_WITH_WHILE_MULTI_GRABBED = "dynamic"; var HEART_BEAT_INTERVAL = 5 * MSECS_PER_SEC; var HEART_BEAT_TIMEOUT = 15 * MSECS_PER_SEC; -var avCollideLater; -var setCollidesLaterTimeout; -var collideLaterID; +var delayedDeactivateFunc; +var delayedDeactivateTimeout; +var delayedDeactivateEntityID; var CONTROLLER_STATE_MACHINE = {}; @@ -2064,15 +2064,15 @@ function MyController(hand) { } this.entityActivated = true; - if (setCollidesLaterTimeout && collideLaterID == entityID) { + if (delayedDeactivateTimeout && delayedDeactivateEntityID == entityID) { // we have a timeout waiting to set collisions with myAvatar back on (so that when something // is thrown it doesn't collide with the avatar's capsule the moment it's released). We've // regrabbed the entity before the timeout fired, so cancel the timeout, run the function now // and adjust the grabbedProperties. This will make the saved set of properties (the ones that // get re-instated after all the grabs have been released) be correct. - Script.clearTimeout(setCollidesLaterTimeout); - setCollidesLaterTimeout = null; - grabbedProperties["collidesWith"] = avCollideLater(); + Script.clearTimeout(delayedDeactivateTimeout); + delayedDeactivateTimeout = null; + grabbedProperties["collidesWith"] = delayedDeactivateFunc(); } var data = getEntityCustomData(GRAB_USER_DATA_KEY, entityID, {}); @@ -2142,7 +2142,27 @@ function MyController(hand) { }); }; - this.deactivateEntity = function (entityID, noVelocity) { + this.delayedDeactivateEntity = function (entityID, collidesWith) { + // If, before the grab started, the held entity collided with myAvatar, we do the deactivation in + // two parts. Most of it is done in deactivateEntity(), but the final collidesWith and refcount + // are delayed a bit. This keeps thrown things from colliding with the avatar's capsule so often. + // The refcount is handled in this delayed fashion so things don't get confused if someone else + // grabs the entity before the timeout fires. + Entities.editEntity(entityID, { collidesWith: collidesWith }); + var data = getEntityCustomData(GRAB_USER_DATA_KEY, entityID, {}); + if (data && data["refCount"]) { + data["refCount"] = data["refCount"] - 1; + if (data["refCount"] < 1) { + data = null; + } + } else { + data = null; + } + + setEntityCustomData(GRAB_USER_DATA_KEY, entityID, data); + }; + + this.deactivateEntity = function (entityID, noVelocity, delayed) { var deactiveProps; if (!this.entityActivated) { @@ -2151,12 +2171,13 @@ function MyController(hand) { this.entityActivated = false; var data = getEntityCustomData(GRAB_USER_DATA_KEY, entityID, {}); + var doDelayedDeactivate = false; if (data && data["refCount"]) { data["refCount"] = data["refCount"] - 1; if (data["refCount"] < 1) { deactiveProps = { gravity: data["gravity"], - // don't set collidesWith back right away, because thrown things tend to bounce off the + // don't set collidesWith myAvatar back right away, because thrown things tend to bounce off the // avatar's capsule. collidesWith: removeMyAvatarFromCollidesWith(data["collidesWith"]), collisionless: data["collisionless"], @@ -2165,17 +2186,20 @@ function MyController(hand) { parentJointIndex: data["parentJointIndex"] }; - if (data["collidesWith"].indexOf("myAvatar") >= 0) { - var javaScriptScopingIsBrokenData = data; - avCollideLater = function () { + doDelayedDeactivate = (data["collidesWith"].indexOf("myAvatar") >= 0); + + if (doDelayedDeactivate) { + var delayedCollidesWith = data["collidesWith"]; + var delayedEntityID = entityID; + delayedDeactivateFunc = function () { // set collidesWith back to original value a bit later than the rest - _this.setCollidesLaterTimeout = null; - Entities.editEntity(entityID, { collidesWith: javaScriptScopingIsBrokenData["collidesWith"] }); - return javaScriptScopingIsBrokenData["collidesWith"]; + delayedDeactivateTimeout = null; + _this.delayedDeactivateEntity(delayedEntityID, delayedCollidesWith); + return delayedCollidesWith; } - setCollidesLaterTimeout = - Script.setTimeout(avCollideLater, COLLIDE_WITH_AV_AFTER_RELEASE_DELAY * MSECS_PER_SEC); - collideLaterID = entityID; + delayedDeactivateTimeout = + Script.setTimeout(delayedDeactivateFunc, COLLIDE_WITH_AV_AFTER_RELEASE_DELAY * MSECS_PER_SEC); + delayedDeactivateEntityID = entityID; } // things that are held by parenting and dropped with no velocity will end up as "static" in bullet. If @@ -2220,7 +2244,6 @@ function MyController(hand) { // angularVelocity: this.currentAngularVelocity }); } - data = null; } else if (this.shouldResetParentOnRelease) { // we parent-grabbed this from another parent grab. try to put it back where we found it. @@ -2239,7 +2262,9 @@ function MyController(hand) { } else { data = null; } - setEntityCustomData(GRAB_USER_DATA_KEY, entityID, data); + if (!doDelayedDeactivate) { + setEntityCustomData(GRAB_USER_DATA_KEY, entityID, data); + } }; this.getOtherHandController = function () { From 6c14ef3392dbdbef2ffa577dabf567f22494d6c6 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 12 Jul 2016 11:56:57 -0700 Subject: [PATCH 12/18] added a comment --- interface/src/avatar/AvatarActionHold.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index 32905361dd..a2130240f5 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -235,7 +235,7 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { } measuredLinearVelocity += _measuredLinearVelocities[i]; } - measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 3); + measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 3); // 3 because of the 3 we skipped, above if (_kinematicSetVelocity) { // rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget)); From 0dd2171b759c1c135485501c32d1b80ada52354b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 12 Jul 2016 11:57:57 -0700 Subject: [PATCH 13/18] remove commented-out code --- interface/src/avatar/AvatarActionHold.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index a2130240f5..bac3b1e02f 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -238,7 +238,6 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 3); // 3 because of the 3 we skipped, above if (_kinematicSetVelocity) { - // rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget)); rigidBody->setLinearVelocity(glmToBullet(measuredLinearVelocity)); rigidBody->setAngularVelocity(glmToBullet(_angularVelocityTarget)); } From b6ffabf5003228385b1543f13283aa44d5f7883a Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 13 Jul 2016 09:08:57 -0700 Subject: [PATCH 14/18] attempt to get mac sandbox plugins to work --- cmake/macros/GenerateInstallers.cmake | 26 +++++++++++++++++++ .../macros/SetupHifiClientServerPlugin.cmake | 3 ++- server-console/CMakeLists.txt | 26 +++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/cmake/macros/GenerateInstallers.cmake b/cmake/macros/GenerateInstallers.cmake index 0def701739..2d2ede69f0 100644 --- a/cmake/macros/GenerateInstallers.cmake +++ b/cmake/macros/GenerateInstallers.cmake @@ -78,6 +78,32 @@ macro(GENERATE_INSTALLERS) install(CODE "execute_process(COMMAND SetFile -a V \${CMAKE_INSTALL_PREFIX}/${ESCAPED_DMG_SUBFOLDER_NAME}/Icon\\r)") endif () + # this is a bit of a hack, but I couldn't find any other way to get plugins + # into the correct place under the console path. On windows this is handled + # exclusively in the plugins directories with the SetupHiFiClientServerPlugin + # macro + if (APPLE) + set(CONSOLE_PLUGINS_DIR "${CONSOLE_INSTALL_APP_PATH}/Contents/MacOS/Components.app/Contents/PlugIns") + set(SERVER_PLUGINS_DIR "${CMAKE_BINARY_DIR}/assignment-client/${CMAKE_BUILD_TYPE}/plugins") + + message("TARGET_NAME: ${TARGET_NAME}") + message("CONFIGURATION: ${CONFIGURATION}") + message(": $") + message("CONSOLE_PLUGINS_DIR: ${CONSOLE_PLUGINS_DIR}") + message("SERVER_PLUGINS_DIR: ${SERVER_PLUGINS_DIR}") + + add_custom_command(TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E make_directory + ${CONSOLE_PLUGINS_DIR} + ) + + add_custom_command(TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory + ${SERVER_PLUGINS_DIR} + ${CONSOLE_PLUGINS_DIR} + ) + endif () + # configure a cpack properties file for custom variables in template set(CPACK_CONFIGURED_PROP_FILE "${CMAKE_CURRENT_BINARY_DIR}/CPackCustomProperties.cmake") configure_file("${HF_CMAKE_DIR}/templates/CPackProperties.cmake.in" ${CPACK_CONFIGURED_PROP_FILE}) diff --git a/cmake/macros/SetupHifiClientServerPlugin.cmake b/cmake/macros/SetupHifiClientServerPlugin.cmake index dfe3113fbc..a065ee99b6 100644 --- a/cmake/macros/SetupHifiClientServerPlugin.cmake +++ b/cmake/macros/SetupHifiClientServerPlugin.cmake @@ -13,7 +13,8 @@ macro(SETUP_HIFI_CLIENT_SERVER_PLUGIN) if (APPLE) set(CLIENT_PLUGIN_PATH "${INTERFACE_BUNDLE_NAME}.app/Contents/PlugIns") - set(SERVER_PLUGIN_PATH "Components.app/Contents/PlugIns") + #set(SERVER_PLUGIN_PATH "Components.app/Contents/PlugIns") + set(SERVER_PLUGIN_PATH "plugins") else() set(CLIENT_PLUGIN_PATH "plugins") set(SERVER_PLUGIN_PATH "plugins") diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 1c6e40c582..7b9c17ace4 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -72,3 +72,29 @@ else () set_target_properties(${TARGET_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE) set_target_properties(${TARGET_NAME}-npm-install PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE) endif () + +# this is a bit of a hack, but I couldn't find any other way to get plugins +# into the correct place under the console path. On windows this is handled +# exclusively in the plugins directories with the SetupHiFiClientServerPlugin +# macro +if (APPLE) + set(CONSOLE_PLUGINS_DIR "${CONSOLE_INSTALL_APP_PATH}/Contents/MacOS/Components.app/Contents/PlugIns") + set(SERVER_PLUGINS_DIR "${CMAKE_BINARY_DIR}/assignment-client/${CMAKE_BUILD_TYPE}/plugins") + + message("TARGET_NAME: ${TARGET_NAME}") + message("CONFIGURATION: ${CONFIGURATION}") + message(": $") + message("CONSOLE_PLUGINS_DIR: ${CONSOLE_PLUGINS_DIR}") + message("SERVER_PLUGINS_DIR: ${SERVER_PLUGINS_DIR}") + + add_custom_command(TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E make_directory + ${CONSOLE_PLUGINS_DIR} + ) + + add_custom_command(TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory + ${SERVER_PLUGINS_DIR} + ${CONSOLE_PLUGINS_DIR} + ) +endif () From 1d77cec125876844b3c4afced504aa475db9a094 Mon Sep 17 00:00:00 2001 From: Anthony Thibault Date: Wed, 13 Jul 2016 07:32:05 -0700 Subject: [PATCH 15/18] Support for scale property on model overlays If "scale" property is present but "dimensions" are not, the model is NOT scale to fit. And the scale of the model's natural dimensions will be affected by the scale properties. If only the "dimensions" property is present, the model will "scale to fit" the dimensions. If both properties are present, the model still be "scale to fit" but the dimension will be scaled by the scale factor. For example: If a model is loaded that is 2cm tall, is loaded with no "dimensions" or "scale" properties. It will be displayed as 2cm tall. {"scale": 2} The above properties will result in a model that is 4cm tall. {"dimensions": 1} This will result in a model that is 1cm tall. {"scale": 2, "dimensions" 2} Will result in a model that is 2cm tall. --- interface/src/ui/overlays/Base3DOverlay.h | 16 +++--- interface/src/ui/overlays/ModelOverlay.cpp | 55 +++++++++++++------ interface/src/ui/overlays/ModelOverlay.h | 5 +- interface/src/ui/overlays/Volume3DOverlay.cpp | 6 +- interface/src/ui/overlays/Volume3DOverlay.h | 14 ++--- 5 files changed, 60 insertions(+), 36 deletions(-) diff --git a/interface/src/ui/overlays/Base3DOverlay.h b/interface/src/ui/overlays/Base3DOverlay.h index 41e7e517b7..e602dec48c 100644 --- a/interface/src/ui/overlays/Base3DOverlay.h +++ b/interface/src/ui/overlays/Base3DOverlay.h @@ -17,7 +17,7 @@ class Base3DOverlay : public Overlay { Q_OBJECT - + public: Base3DOverlay(); Base3DOverlay(const Base3DOverlay* base3DOverlay); @@ -27,10 +27,10 @@ public: const glm::vec3& getPosition() const { return _transform.getTranslation(); } const glm::quat& getRotation() const { return _transform.getRotation(); } const glm::vec3& getScale() const { return _transform.getScale(); } - + // TODO: consider implementing registration points in this class const glm::vec3& getCenter() const { return getPosition(); } - + float getLineWidth() const { return _lineWidth; } bool getIsSolid() const { return _isSolid; } bool getIsDashedLine() const { return _isDashedLine; } @@ -43,7 +43,7 @@ public: void setRotation(const glm::quat& value) { _transform.setRotation(value); } void setScale(float value) { _transform.setScale(value); } void setScale(const glm::vec3& value) { _transform.setScale(value); } - + void setLineWidth(float lineWidth) { _lineWidth = lineWidth; } void setIsSolid(bool isSolid) { _isSolid = isSolid; } void setIsDashedLine(bool isDashedLine) { _isDashedLine = isDashedLine; } @@ -55,22 +55,22 @@ public: void setProperties(const QVariantMap& properties) override; QVariant getProperty(const QString& property) override; - virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, + virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, BoxFace& face, glm::vec3& surfaceNormal); - virtual bool findRayIntersectionExtraInfo(const glm::vec3& origin, const glm::vec3& direction, + virtual bool findRayIntersectionExtraInfo(const glm::vec3& origin, const glm::vec3& direction, float& distance, BoxFace& face, glm::vec3& surfaceNormal, QString& extraInfo) { return findRayIntersection(origin, direction, distance, face, surfaceNormal); } protected: Transform _transform; - + float _lineWidth; bool _isSolid; bool _isDashedLine; bool _ignoreRayIntersection; bool _drawInFront; }; - + #endif // hifi_Base3DOverlay_h diff --git a/interface/src/ui/overlays/ModelOverlay.cpp b/interface/src/ui/overlays/ModelOverlay.cpp index a857dc39e0..2897c07e64 100644 --- a/interface/src/ui/overlays/ModelOverlay.cpp +++ b/interface/src/ui/overlays/ModelOverlay.cpp @@ -19,8 +19,7 @@ QString const ModelOverlay::TYPE = "model"; ModelOverlay::ModelOverlay() : _model(std::make_shared(std::make_shared())), - _modelTextures(QVariantMap()), - _updateModel(false) + _modelTextures(QVariantMap()) { _model->init(); _isLoaded = false; @@ -44,7 +43,11 @@ void ModelOverlay::update(float deltatime) { if (_updateModel) { _updateModel = false; _model->setSnapModelToCenter(true); - _model->setScaleToFit(true, getDimensions()); + if (_scaleToFit) { + _model->setScaleToFit(true, getScale() * getDimensions()); + } else { + _model->setScale(getScale()); + } _model->setRotation(getRotation()); _model->setTranslation(getPosition()); _model->setURL(_url); @@ -84,16 +87,33 @@ void ModelOverlay::render(RenderArgs* args) { } void ModelOverlay::setProperties(const QVariantMap& properties) { - auto position = getPosition(); - auto rotation = getRotation(); + auto origPosition = getPosition(); + auto origRotation = getRotation(); + auto origDimensions = getDimensions(); + auto origScale = getScale(); - Volume3DOverlay::setProperties(properties); + Base3DOverlay::setProperties(properties); - if (position != getPosition() || rotation != getRotation()) { - _updateModel = true; + auto scale = properties["scale"]; + if (scale.isValid()) { + setScale(vec3FromVariant(scale)); } - _updateModel = true; + auto dimensions = properties["dimensions"]; + if (dimensions.isValid()) { + _scaleToFit = true; + setDimensions(vec3FromVariant(dimensions)); + } else if (scale.isValid()) { + // if "scale" property is set but "dimentions" is not. + // do NOT scale to fit. + if (scale.isValid()) { + _scaleToFit = false; + } + } + + if (origPosition != getPosition() || origRotation != getRotation() || origDimensions != getDimensions() || origScale != getScale()) { + _updateModel = true; + } auto urlValue = properties["url"]; if (urlValue.isValid() && urlValue.canConvert()) { @@ -101,15 +121,15 @@ void ModelOverlay::setProperties(const QVariantMap& properties) { _updateModel = true; _isLoaded = false; } - + auto texturesValue = properties["textures"]; if (texturesValue.isValid() && texturesValue.canConvert(QVariant::Map)) { QVariantMap textureMap = texturesValue.toMap(); foreach(const QString& key, textureMap.keys()) { - + QUrl newTextureURL = textureMap[key].toUrl(); qDebug() << "Updating texture named" << key << "to texture at URL" << newTextureURL; - + QMetaObject::invokeMethod(_model.get(), "setTextureWithNameToURL", Qt::AutoConnection, Q_ARG(const QString&, key), Q_ARG(const QUrl&, newTextureURL)); @@ -123,8 +143,11 @@ QVariant ModelOverlay::getProperty(const QString& property) { if (property == "url") { return _url.toString(); } - if (property == "dimensions" || property == "scale" || property == "size") { - return vec3toVariant(_model->getScaleToFitDimensions()); + if (property == "dimensions" || property == "size") { + return vec3toVariant(getDimensions()); + } + if (property == "scale") { + return vec3toVariant(getScale()); } if (property == "textures") { if (_modelTextures.size() > 0) { @@ -143,14 +166,14 @@ QVariant ModelOverlay::getProperty(const QString& property) { bool ModelOverlay::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, BoxFace& face, glm::vec3& surfaceNormal) { - + QString subMeshNameTemp; return _model->findRayIntersectionAgainstSubMeshes(origin, direction, distance, face, surfaceNormal, subMeshNameTemp); } bool ModelOverlay::findRayIntersectionExtraInfo(const glm::vec3& origin, const glm::vec3& direction, float& distance, BoxFace& face, glm::vec3& surfaceNormal, QString& extraInfo) { - + return _model->findRayIntersectionAgainstSubMeshes(origin, direction, distance, face, surfaceNormal, extraInfo); } diff --git a/interface/src/ui/overlays/ModelOverlay.h b/interface/src/ui/overlays/ModelOverlay.h index dc4b4a853b..091cab44c9 100644 --- a/interface/src/ui/overlays/ModelOverlay.h +++ b/interface/src/ui/overlays/ModelOverlay.h @@ -43,9 +43,10 @@ private: ModelPointer _model; QVariantMap _modelTextures; - + QUrl _url; - bool _updateModel; + bool _updateModel = { false }; + bool _scaleToFit = { false }; }; #endif // hifi_ModelOverlay_h diff --git a/interface/src/ui/overlays/Volume3DOverlay.cpp b/interface/src/ui/overlays/Volume3DOverlay.cpp index c8078d35c6..563198c976 100644 --- a/interface/src/ui/overlays/Volume3DOverlay.cpp +++ b/interface/src/ui/overlays/Volume3DOverlay.cpp @@ -22,7 +22,7 @@ AABox Volume3DOverlay::getBounds() const { auto extents = Extents{_localBoundingBox}; extents.rotate(getRotation()); extents.shiftBy(getPosition()); - + return AABox(extents); } @@ -31,7 +31,7 @@ void Volume3DOverlay::setProperties(const QVariantMap& properties) { auto dimensions = properties["dimensions"]; - // if "dimensions" property was not there, check to see if they included aliases: scale + // if "dimensions" property was not there, check to see if they included aliases: scale, size if (!dimensions.isValid()) { dimensions = properties["scale"]; if (!dimensions.isValid()) { @@ -57,7 +57,7 @@ bool Volume3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::ve // extents is the entity relative, scaled, centered extents of the entity glm::mat4 worldToEntityMatrix; _transform.getInverseMatrix(worldToEntityMatrix); - + glm::vec3 overlayFrameOrigin = glm::vec3(worldToEntityMatrix * glm::vec4(origin, 1.0f)); glm::vec3 overlayFrameDirection = glm::vec3(worldToEntityMatrix * glm::vec4(direction, 0.0f)); diff --git a/interface/src/ui/overlays/Volume3DOverlay.h b/interface/src/ui/overlays/Volume3DOverlay.h index 4d087615d2..04b694b2f8 100644 --- a/interface/src/ui/overlays/Volume3DOverlay.h +++ b/interface/src/ui/overlays/Volume3DOverlay.h @@ -15,13 +15,13 @@ class Volume3DOverlay : public Base3DOverlay { Q_OBJECT - + public: Volume3DOverlay() {} Volume3DOverlay(const Volume3DOverlay* volume3DOverlay); - + virtual AABox getBounds() const override; - + const glm::vec3& getDimensions() const { return _localBoundingBox.getDimensions(); } void setDimensions(float value) { _localBoundingBox.setBox(glm::vec3(-value / 2.0f), value); } void setDimensions(const glm::vec3& value) { _localBoundingBox.setBox(-value / 2.0f, value); } @@ -29,13 +29,13 @@ public: void setProperties(const QVariantMap& properties) override; QVariant getProperty(const QString& property) override; - virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, - BoxFace& face, glm::vec3& surfaceNormal) override; - + virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, + BoxFace& face, glm::vec3& surfaceNormal) override; + protected: // Centered local bounding box AABox _localBoundingBox{ vec3(0.0f), 1.0f }; }; - + #endif // hifi_Volume3DOverlay_h From 789297d8496cbb9228d12123ffc691f3ae70ab02 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 13 Jul 2016 17:39:39 -0700 Subject: [PATCH 16/18] Remove redundant isValid check. --- interface/src/ui/overlays/ModelOverlay.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/interface/src/ui/overlays/ModelOverlay.cpp b/interface/src/ui/overlays/ModelOverlay.cpp index 2897c07e64..9c203c0129 100644 --- a/interface/src/ui/overlays/ModelOverlay.cpp +++ b/interface/src/ui/overlays/ModelOverlay.cpp @@ -106,9 +106,7 @@ void ModelOverlay::setProperties(const QVariantMap& properties) { } else if (scale.isValid()) { // if "scale" property is set but "dimentions" is not. // do NOT scale to fit. - if (scale.isValid()) { - _scaleToFit = false; - } + _scaleToFit = false; } if (origPosition != getPosition() || origRotation != getRotation() || origDimensions != getDimensions() || origScale != getScale()) { From c2fd055f0f12992cdd5d64cddf97a610d21badcb Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 13 Jul 2016 17:23:00 -0700 Subject: [PATCH 17/18] more hacking --- cmake/macros/GenerateInstallers.cmake | 26 ------------------- cmake/macros/InstallBesideConsole.cmake | 1 + cmake/macros/SetPackagingParameters.cmake | 2 ++ .../macros/SetupHifiClientServerPlugin.cmake | 1 - plugins/hifiCodec/CMakeLists.txt | 1 + plugins/pcmCodec/CMakeLists.txt | 2 ++ server-console/CMakeLists.txt | 26 ------------------- 7 files changed, 6 insertions(+), 53 deletions(-) diff --git a/cmake/macros/GenerateInstallers.cmake b/cmake/macros/GenerateInstallers.cmake index 2d2ede69f0..0def701739 100644 --- a/cmake/macros/GenerateInstallers.cmake +++ b/cmake/macros/GenerateInstallers.cmake @@ -78,32 +78,6 @@ macro(GENERATE_INSTALLERS) install(CODE "execute_process(COMMAND SetFile -a V \${CMAKE_INSTALL_PREFIX}/${ESCAPED_DMG_SUBFOLDER_NAME}/Icon\\r)") endif () - # this is a bit of a hack, but I couldn't find any other way to get plugins - # into the correct place under the console path. On windows this is handled - # exclusively in the plugins directories with the SetupHiFiClientServerPlugin - # macro - if (APPLE) - set(CONSOLE_PLUGINS_DIR "${CONSOLE_INSTALL_APP_PATH}/Contents/MacOS/Components.app/Contents/PlugIns") - set(SERVER_PLUGINS_DIR "${CMAKE_BINARY_DIR}/assignment-client/${CMAKE_BUILD_TYPE}/plugins") - - message("TARGET_NAME: ${TARGET_NAME}") - message("CONFIGURATION: ${CONFIGURATION}") - message(": $") - message("CONSOLE_PLUGINS_DIR: ${CONSOLE_PLUGINS_DIR}") - message("SERVER_PLUGINS_DIR: ${SERVER_PLUGINS_DIR}") - - add_custom_command(TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E make_directory - ${CONSOLE_PLUGINS_DIR} - ) - - add_custom_command(TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_directory - ${SERVER_PLUGINS_DIR} - ${CONSOLE_PLUGINS_DIR} - ) - endif () - # configure a cpack properties file for custom variables in template set(CPACK_CONFIGURED_PROP_FILE "${CMAKE_CURRENT_BINARY_DIR}/CPackCustomProperties.cmake") configure_file("${HF_CMAKE_DIR}/templates/CPackProperties.cmake.in" ${CPACK_CONFIGURED_PROP_FILE}) diff --git a/cmake/macros/InstallBesideConsole.cmake b/cmake/macros/InstallBesideConsole.cmake index 318a7a3ffe..0eb6025f38 100644 --- a/cmake/macros/InstallBesideConsole.cmake +++ b/cmake/macros/InstallBesideConsole.cmake @@ -16,6 +16,7 @@ macro(install_beside_console) install( TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${COMPONENT_INSTALL_DIR} + LIBRARY DESTINATION ${CONSOLE_PLUGIN_INSTALL_DIR} COMPONENT ${SERVER_COMPONENT} ) else () diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index d8532aa081..76f6812921 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -69,6 +69,8 @@ macro(SET_PACKAGING_PARAMETERS) set(CONSOLE_APP_CONTENTS "${CONSOLE_INSTALL_APP_PATH}/Contents") set(COMPONENT_APP_PATH "${CONSOLE_APP_CONTENTS}/MacOS/Components.app") set(COMPONENT_INSTALL_DIR "${COMPONENT_APP_PATH}/Contents/MacOS") + set(CONSOLE_PLUGIN_INSTALL_DIR "${COMPONENT_APP_PATH}/Contents/PlugIns") + set(INTERFACE_INSTALL_APP_PATH "${CONSOLE_INSTALL_DIR}/${INTERFACE_BUNDLE_NAME}.app") set(INTERFACE_ICON_FILENAME "${INTERFACE_ICON_PREFIX}.icns") diff --git a/cmake/macros/SetupHifiClientServerPlugin.cmake b/cmake/macros/SetupHifiClientServerPlugin.cmake index a065ee99b6..8ba38a09c3 100644 --- a/cmake/macros/SetupHifiClientServerPlugin.cmake +++ b/cmake/macros/SetupHifiClientServerPlugin.cmake @@ -13,7 +13,6 @@ macro(SETUP_HIFI_CLIENT_SERVER_PLUGIN) if (APPLE) set(CLIENT_PLUGIN_PATH "${INTERFACE_BUNDLE_NAME}.app/Contents/PlugIns") - #set(SERVER_PLUGIN_PATH "Components.app/Contents/PlugIns") set(SERVER_PLUGIN_PATH "plugins") else() set(CLIENT_PLUGIN_PATH "plugins") diff --git a/plugins/hifiCodec/CMakeLists.txt b/plugins/hifiCodec/CMakeLists.txt index 3939529c3e..0af7e42ea1 100644 --- a/plugins/hifiCodec/CMakeLists.txt +++ b/plugins/hifiCodec/CMakeLists.txt @@ -15,5 +15,6 @@ if (WIN32 OR APPLE) add_dependency_external_projects(HiFiAudioCodec) target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${HIFIAUDIOCODEC_LIBRARIES}) + install_beside_console() endif() diff --git a/plugins/pcmCodec/CMakeLists.txt b/plugins/pcmCodec/CMakeLists.txt index 5dca1f0e14..900a642a88 100644 --- a/plugins/pcmCodec/CMakeLists.txt +++ b/plugins/pcmCodec/CMakeLists.txt @@ -9,3 +9,5 @@ set(TARGET_NAME pcmCodec) setup_hifi_client_server_plugin() link_hifi_libraries(shared plugins) +install_beside_console() + diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt index 7b9c17ace4..1c6e40c582 100644 --- a/server-console/CMakeLists.txt +++ b/server-console/CMakeLists.txt @@ -72,29 +72,3 @@ else () set_target_properties(${TARGET_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE) set_target_properties(${TARGET_NAME}-npm-install PROPERTIES EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_DEFAULT_BUILD TRUE) endif () - -# this is a bit of a hack, but I couldn't find any other way to get plugins -# into the correct place under the console path. On windows this is handled -# exclusively in the plugins directories with the SetupHiFiClientServerPlugin -# macro -if (APPLE) - set(CONSOLE_PLUGINS_DIR "${CONSOLE_INSTALL_APP_PATH}/Contents/MacOS/Components.app/Contents/PlugIns") - set(SERVER_PLUGINS_DIR "${CMAKE_BINARY_DIR}/assignment-client/${CMAKE_BUILD_TYPE}/plugins") - - message("TARGET_NAME: ${TARGET_NAME}") - message("CONFIGURATION: ${CONFIGURATION}") - message(": $") - message("CONSOLE_PLUGINS_DIR: ${CONSOLE_PLUGINS_DIR}") - message("SERVER_PLUGINS_DIR: ${SERVER_PLUGINS_DIR}") - - add_custom_command(TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E make_directory - ${CONSOLE_PLUGINS_DIR} - ) - - add_custom_command(TARGET ${TARGET_NAME} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_directory - ${SERVER_PLUGINS_DIR} - ${CONSOLE_PLUGINS_DIR} - ) -endif () From 44500889f8ff0336ad9911ed2f3015f134ea38d2 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 14 Jul 2016 13:34:56 -0700 Subject: [PATCH 18/18] Remove 'updating reverb' logspam --- libraries/audio-client/src/AudioClient.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index dd72125d93..bec30edb4e 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -954,7 +954,6 @@ void AudioClient::processReceivedSamples(const QByteArray& decodedBuffer, QByteA if (hasReverb) { assert(_outputFormat.channelCount() == 2); updateReverbOptions(); - qDebug() << "handling reverb"; _listenerReverb.render(outputSamples, outputSamples, numDeviceOutputSamples/2); } }