From e8ce1526876cfbba3c883891e9aa1165ea24adb6 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Wed, 5 Sep 2018 14:46:07 -0700 Subject: [PATCH 01/15] Scale collision picks relative to parent by adding and using more specialized transform nodes. --- .../src/raypick/PickScriptingInterface.cpp | 16 ++++++++-- .../src/ui/overlays/OverlayTransformNode.cpp | 30 +++++++++++++++++++ .../src/ui/overlays/OverlayTransformNode.h | 26 ++++++++++++++++ .../avatars-renderer/AvatarTransformNode.cpp | 30 +++++++++++++++++++ .../avatars-renderer/AvatarTransformNode.h | 25 ++++++++++++++++ .../entities/src/EntityTransformNode.cpp | 30 +++++++++++++++++++ libraries/entities/src/EntityTransformNode.h | 25 ++++++++++++++++ 7 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 interface/src/ui/overlays/OverlayTransformNode.cpp create mode 100644 interface/src/ui/overlays/OverlayTransformNode.h create mode 100644 libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp create mode 100644 libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h create mode 100644 libraries/entities/src/EntityTransformNode.cpp create mode 100644 libraries/entities/src/EntityTransformNode.h diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 6dedf3fca1..c3a783a72b 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -24,11 +24,13 @@ #include "CollisionPick.h" #include "SpatialParentFinder.h" -#include "NestableTransformNode.h" #include "PickTransformNode.h" #include "MouseTransformNode.h" #include "avatar/MyAvatarHeadTransformNode.h" #include "avatar/AvatarManager.h" +#include "avatars-renderer/AvatarTransformNode.h" +#include "ui/overlays/OverlayTransformNode.h" +#include "EntityTransformNode.h" #include @@ -375,6 +377,16 @@ std::shared_ptr PickScriptingInterface::createTransformNode(const } auto sharedNestablePointer = nestablePointer.lock(); if (success && sharedNestablePointer) { + NestableType nestableType = sharedNestablePointer->getNestableType(); + if (nestableType == NestableType::Avatar) { + return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); + } + if (nestableType == NestableType::Overlay) { + return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); + } + if (nestableType == NestableType::Entity) { + return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); + } return std::make_shared(nestablePointer, parentJointIndex); } } @@ -394,7 +406,7 @@ std::shared_ptr PickScriptingInterface::createTransformNode(const } else if (!joint.isNull()) { auto myAvatar = DependencyManager::get()->getMyAvatar(); int jointIndex = myAvatar->getJointIndex(joint); - return std::make_shared(myAvatar, jointIndex); + return std::make_shared(myAvatar, jointIndex); } } diff --git a/interface/src/ui/overlays/OverlayTransformNode.cpp b/interface/src/ui/overlays/OverlayTransformNode.cpp new file mode 100644 index 0000000000..64f5be932c --- /dev/null +++ b/interface/src/ui/overlays/OverlayTransformNode.cpp @@ -0,0 +1,30 @@ +// +// Created by Sabrina Shanman 9/5/2018 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "OverlayTransformNode.h" + +OverlayTransformNode::OverlayTransformNode(std::weak_ptr overlay, int jointIndex) : + _overlay(overlay), + _jointIndex(jointIndex) +{} + +Transform OverlayTransformNode::getTransform() { + auto overlay = _overlay.lock(); + if (!overlay) { + return Transform(); + } + + bool success; + Transform jointWorldTransform = overlay->getTransform(_jointIndex, success); + if (!success) { + jointWorldTransform = Transform(); + } + + jointWorldTransform.setScale(overlay->getBounds().getScale()); + + return jointWorldTransform; +} \ No newline at end of file diff --git a/interface/src/ui/overlays/OverlayTransformNode.h b/interface/src/ui/overlays/OverlayTransformNode.h new file mode 100644 index 0000000000..79e6a37f45 --- /dev/null +++ b/interface/src/ui/overlays/OverlayTransformNode.h @@ -0,0 +1,26 @@ +// +// Created by Sabrina Shanman 9/5/2018 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#ifndef hifi_OverlayTransformNode_h +#define hifi_OverlayTransformNode_h + +#include "NestableTransformNode.h" + +#include "Base3DOverlay.h" + +// For 3D overlays only +class OverlayTransformNode : public TransformNode { +public: + OverlayTransformNode(std::weak_ptr overlay, int jointIndex); + Transform getTransform() override; + +protected: + std::weak_ptr _overlay; + int _jointIndex; +}; + +#endif // hifi_OverlayTransformNode_h \ No newline at end of file diff --git a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp new file mode 100644 index 0000000000..2f198e8917 --- /dev/null +++ b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp @@ -0,0 +1,30 @@ +// +// Created by Sabrina Shanman 9/5/2018 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "AvatarTransformNode.h" + +AvatarTransformNode::AvatarTransformNode(AvatarWeakPointer avatar, int jointIndex) : + _avatar(avatar), + _jointIndex(jointIndex) +{} + +Transform AvatarTransformNode::getTransform() { + auto avatar = _avatar.lock(); + if (!avatar) { + return Transform(); + } + + bool success; + Transform jointWorldTransform = avatar->getTransform(_jointIndex, success); + if (!success) { + jointWorldTransform = Transform(); + } + + jointWorldTransform.setScale(avatar->scaleForChildren()); + + return jointWorldTransform; +} \ No newline at end of file diff --git a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h new file mode 100644 index 0000000000..9036d42639 --- /dev/null +++ b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h @@ -0,0 +1,25 @@ +// +// Created by Sabrina Shanman 9/5/2018 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#ifndef hifi_AvatarTransformNode_h +#define hifi_AvatarTransformNode_h + +#include "NestableTransformNode.h" + +#include "Avatar.h" + +class AvatarTransformNode : public TransformNode { +public: + AvatarTransformNode(AvatarWeakPointer avatar, int jointIndex); + Transform getTransform() override; + +protected: + AvatarWeakPointer _avatar; + int _jointIndex; +}; + +#endif // hifi_AvatarTransformNode_h \ No newline at end of file diff --git a/libraries/entities/src/EntityTransformNode.cpp b/libraries/entities/src/EntityTransformNode.cpp new file mode 100644 index 0000000000..42b60759db --- /dev/null +++ b/libraries/entities/src/EntityTransformNode.cpp @@ -0,0 +1,30 @@ +// +// Created by Sabrina Shanman 9/5/2018 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "EntityTransformNode.h" + +EntityTransformNode::EntityTransformNode(EntityItemWeakPointer entity, int jointIndex) : + _entity(entity), + _jointIndex(jointIndex) +{} + +Transform EntityTransformNode::getTransform() { + auto entity = _entity.lock(); + if (!entity) { + return Transform(); + } + + bool success; + Transform jointWorldTransform = entity->getTransform(_jointIndex, success); + if (!success) { + jointWorldTransform = Transform(); + } + + jointWorldTransform.setScale(entity->getScaledDimensions()); + + return jointWorldTransform; +} \ No newline at end of file diff --git a/libraries/entities/src/EntityTransformNode.h b/libraries/entities/src/EntityTransformNode.h new file mode 100644 index 0000000000..fc5eeff652 --- /dev/null +++ b/libraries/entities/src/EntityTransformNode.h @@ -0,0 +1,25 @@ +// +// Created by Sabrina Shanman 9/5/2018 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#ifndef hifi_EntityTransformNode_h +#define hifi_EntityTransformNode_h + +#include "NestableTransformNode.h" + +#include "EntityItem.h" + +class EntityTransformNode : public TransformNode { +public: + EntityTransformNode(EntityItemWeakPointer entity, int jointIndex); + Transform getTransform() override; + +protected: + EntityItemWeakPointer _entity; + int _jointIndex; +}; + +#endif // hifi_EntityTransformNode_h \ No newline at end of file From 84a2512f315d581edd54400ecb2cf457b69fc5b7 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Wed, 5 Sep 2018 16:50:39 -0700 Subject: [PATCH 02/15] Fix collision pick scale not being used --- interface/src/raypick/CollisionPick.cpp | 18 +++++++++--------- interface/src/raypick/CollisionPick.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/interface/src/raypick/CollisionPick.cpp b/interface/src/raypick/CollisionPick.cpp index 7d0276875b..d183aecfeb 100644 --- a/interface/src/raypick/CollisionPick.cpp +++ b/interface/src/raypick/CollisionPick.cpp @@ -86,23 +86,23 @@ bool CollisionPick::isLoaded() const { return !_mathPick.shouldComputeShapeInfo() || (_cachedResource && _cachedResource->isLoaded()); } -bool CollisionPick::getShapeInfoReady() { +bool CollisionPick::getShapeInfoReady(const CollisionRegion& pick) { if (_mathPick.shouldComputeShapeInfo()) { if (_cachedResource && _cachedResource->isLoaded()) { - computeShapeInfo(_mathPick, *_mathPick.shapeInfo, _cachedResource); + computeShapeInfo(pick, *_mathPick.shapeInfo, _cachedResource); _mathPick.loaded = true; } else { _mathPick.loaded = false; } } else { - computeShapeInfoDimensionsOnly(_mathPick, *_mathPick.shapeInfo, _cachedResource); + computeShapeInfoDimensionsOnly(pick, *_mathPick.shapeInfo, _cachedResource); _mathPick.loaded = true; } return _mathPick.loaded; } -void CollisionPick::computeShapeInfoDimensionsOnly(CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource) { +void CollisionPick::computeShapeInfoDimensionsOnly(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource) { ShapeType type = shapeInfo.getType(); glm::vec3 dimensions = pick.transform.getScale(); QString modelURL = (resource ? resource->getURL().toString() : ""); @@ -115,7 +115,7 @@ void CollisionPick::computeShapeInfoDimensionsOnly(CollisionRegion& pick, ShapeI } } -void CollisionPick::computeShapeInfo(CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource) { +void CollisionPick::computeShapeInfo(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource) { // This code was copied and modified from RenderableModelEntityItem::computeShapeInfo // TODO: Move to some shared code area (in entities-renderer? model-networking?) // after we verify this is working and do a diff comparison with RenderableModelEntityItem::computeShapeInfo @@ -393,9 +393,9 @@ PickResultPointer CollisionPick::getEntityIntersection(const CollisionRegion& pi // Cannot compute result return std::make_shared(pick.toVariantMap(), std::vector(), std::vector()); } - getShapeInfoReady(); + getShapeInfoReady(pick); - auto entityIntersections = _physicsEngine->contactTest(USER_COLLISION_MASK_ENTITIES, *pick.shapeInfo, pick.transform, USER_COLLISION_GROUP_DYNAMIC, pick.threshold); + auto entityIntersections = _physicsEngine->contactTest(USER_COLLISION_MASK_ENTITIES, *_mathPick.shapeInfo, pick.transform, USER_COLLISION_GROUP_DYNAMIC, pick.threshold); filterIntersections(entityIntersections); return std::make_shared(pick, entityIntersections, std::vector()); } @@ -409,9 +409,9 @@ PickResultPointer CollisionPick::getAvatarIntersection(const CollisionRegion& pi // Cannot compute result return std::make_shared(pick, std::vector(), std::vector()); } - getShapeInfoReady(); + getShapeInfoReady(pick); - auto avatarIntersections = _physicsEngine->contactTest(USER_COLLISION_MASK_AVATARS, *pick.shapeInfo, pick.transform, USER_COLLISION_GROUP_DYNAMIC, pick.threshold); + auto avatarIntersections = _physicsEngine->contactTest(USER_COLLISION_MASK_AVATARS, *_mathPick.shapeInfo, pick.transform, USER_COLLISION_GROUP_DYNAMIC, pick.threshold); filterIntersections(avatarIntersections); return std::make_shared(pick, std::vector(), avatarIntersections); } diff --git a/interface/src/raypick/CollisionPick.h b/interface/src/raypick/CollisionPick.h index ce8b3bd199..fe0e5a6337 100644 --- a/interface/src/raypick/CollisionPick.h +++ b/interface/src/raypick/CollisionPick.h @@ -62,9 +62,9 @@ protected: // Returns true if the resource for _mathPick.shapeInfo is loaded or if a resource is not needed. bool isLoaded() const; // Returns true if _mathPick.shapeInfo is valid. Otherwise, attempts to get the _mathPick ready for use. - bool getShapeInfoReady(); - void computeShapeInfo(CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource); - void computeShapeInfoDimensionsOnly(CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource); + bool getShapeInfoReady(const CollisionRegion& pick); + void computeShapeInfo(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource); + void computeShapeInfoDimensionsOnly(const CollisionRegion& pick, ShapeInfo& shapeInfo, QSharedPointer resource); void filterIntersections(std::vector& intersections) const; CollisionRegion _mathPick; From f7226757ad0d901adf02859e20025b616dd4b058 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 10:03:05 -0700 Subject: [PATCH 03/15] Just import TransformNode in AvatarTransformNode.h and similar --- interface/src/ui/overlays/OverlayTransformNode.h | 2 +- .../avatars-renderer/src/avatars-renderer/AvatarTransformNode.h | 2 +- libraries/entities/src/EntityTransformNode.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/ui/overlays/OverlayTransformNode.h b/interface/src/ui/overlays/OverlayTransformNode.h index 79e6a37f45..b9ea9f72c4 100644 --- a/interface/src/ui/overlays/OverlayTransformNode.h +++ b/interface/src/ui/overlays/OverlayTransformNode.h @@ -8,7 +8,7 @@ #ifndef hifi_OverlayTransformNode_h #define hifi_OverlayTransformNode_h -#include "NestableTransformNode.h" +#include "TransformNode.h" #include "Base3DOverlay.h" diff --git a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h index 9036d42639..03191b8dbe 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h +++ b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h @@ -8,7 +8,7 @@ #ifndef hifi_AvatarTransformNode_h #define hifi_AvatarTransformNode_h -#include "NestableTransformNode.h" +#include "TransformNode.h" #include "Avatar.h" diff --git a/libraries/entities/src/EntityTransformNode.h b/libraries/entities/src/EntityTransformNode.h index fc5eeff652..b7388600df 100644 --- a/libraries/entities/src/EntityTransformNode.h +++ b/libraries/entities/src/EntityTransformNode.h @@ -8,7 +8,7 @@ #ifndef hifi_EntityTransformNode_h #define hifi_EntityTransformNode_h -#include "NestableTransformNode.h" +#include "TransformNode.h" #include "EntityItem.h" From 390e89a64ddfa8cecead7f1b2e3403d80e63939b Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 10:20:26 -0700 Subject: [PATCH 04/15] Fix missing NestableTransformNode import --- interface/src/raypick/PickScriptingInterface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index c3a783a72b..41dd3bb6de 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -28,6 +28,7 @@ #include "MouseTransformNode.h" #include "avatar/MyAvatarHeadTransformNode.h" #include "avatar/AvatarManager.h" +#include "NestableTransformNode.h" #include "avatars-renderer/AvatarTransformNode.h" #include "ui/overlays/OverlayTransformNode.h" #include "EntityTransformNode.h" From e8ea95e3758ec5893100d49eae30549d94dbb6c5 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 10:21:48 -0700 Subject: [PATCH 05/15] Use elseifs in PickScriptingInterface::createTransformNode --- interface/src/raypick/PickScriptingInterface.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 41dd3bb6de..6b8a2d0d7a 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -381,14 +381,13 @@ std::shared_ptr PickScriptingInterface::createTransformNode(const NestableType nestableType = sharedNestablePointer->getNestableType(); if (nestableType == NestableType::Avatar) { return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); - } - if (nestableType == NestableType::Overlay) { + } else if (nestableType == NestableType::Overlay) { return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); - } - if (nestableType == NestableType::Entity) { + } else if (nestableType == NestableType::Entity) { return std::make_shared(std::static_pointer_cast(sharedNestablePointer), parentJointIndex); + } else { + return std::make_shared(nestablePointer, parentJointIndex); } - return std::make_shared(nestablePointer, parentJointIndex); } } From 3f7a7fb11ab1bf4877f59e93381a3df8bbf0dc56 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 10:29:01 -0700 Subject: [PATCH 06/15] Return early from AvatarTransformNode and similar when getTransform fails --- interface/src/ui/overlays/OverlayTransformNode.cpp | 2 +- .../src/avatars-renderer/AvatarTransformNode.cpp | 2 +- libraries/entities/src/EntityTransformNode.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/ui/overlays/OverlayTransformNode.cpp b/interface/src/ui/overlays/OverlayTransformNode.cpp index 64f5be932c..d0a6618e37 100644 --- a/interface/src/ui/overlays/OverlayTransformNode.cpp +++ b/interface/src/ui/overlays/OverlayTransformNode.cpp @@ -21,7 +21,7 @@ Transform OverlayTransformNode::getTransform() { bool success; Transform jointWorldTransform = overlay->getTransform(_jointIndex, success); if (!success) { - jointWorldTransform = Transform(); + return Transform(); } jointWorldTransform.setScale(overlay->getBounds().getScale()); diff --git a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp index 2f198e8917..fc5ba5bc1a 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp @@ -21,7 +21,7 @@ Transform AvatarTransformNode::getTransform() { bool success; Transform jointWorldTransform = avatar->getTransform(_jointIndex, success); if (!success) { - jointWorldTransform = Transform(); + return Transform(); } jointWorldTransform.setScale(avatar->scaleForChildren()); diff --git a/libraries/entities/src/EntityTransformNode.cpp b/libraries/entities/src/EntityTransformNode.cpp index 42b60759db..5b0a690619 100644 --- a/libraries/entities/src/EntityTransformNode.cpp +++ b/libraries/entities/src/EntityTransformNode.cpp @@ -21,7 +21,7 @@ Transform EntityTransformNode::getTransform() { bool success; Transform jointWorldTransform = entity->getTransform(_jointIndex, success); if (!success) { - jointWorldTransform = Transform(); + return Transform(); } jointWorldTransform.setScale(entity->getScaledDimensions()); From 7839ba42db01d7b5b755a961830530f731602148 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 10:37:48 -0700 Subject: [PATCH 07/15] Make the Collision Pick threshold scale with the largest dimension of the parent --- interface/src/raypick/CollisionPick.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/interface/src/raypick/CollisionPick.cpp b/interface/src/raypick/CollisionPick.cpp index d183aecfeb..c21ee69b74 100644 --- a/interface/src/raypick/CollisionPick.cpp +++ b/interface/src/raypick/CollisionPick.cpp @@ -357,12 +357,14 @@ CollisionPick::CollisionPick(const PickFilter& filter, float maxDistance, bool e CollisionRegion CollisionPick::getMathematicalPick() const { CollisionRegion mathPick = _mathPick; mathPick.loaded = isLoaded(); - if (!parentTransform) { - return mathPick; - } else { - mathPick.transform = parentTransform->getTransform().worldTransform(mathPick.transform); - return mathPick; + if (parentTransform) { + Transform parentTransformValue = parentTransform->getTransform(); + mathPick.transform = parentTransformValue.worldTransform(mathPick.transform); + glm::vec3 scale = parentTransformValue.getScale(); + float largestDimension = glm::max(glm::max(scale.x, scale.y), scale.z); + mathPick.threshold *= largestDimension; } + return mathPick; } void CollisionPick::filterIntersections(std::vector& intersections) const { From 727b62144fb939501af03a4034850f4474f9a222 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 12:03:13 -0700 Subject: [PATCH 08/15] Fix MyAvatarHeadTransformNode not using avatar scale --- interface/src/avatar/MyAvatarHeadTransformNode.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatarHeadTransformNode.cpp b/interface/src/avatar/MyAvatarHeadTransformNode.cpp index 9c202ba94a..1e83a17dd3 100644 --- a/interface/src/avatar/MyAvatarHeadTransformNode.cpp +++ b/interface/src/avatar/MyAvatarHeadTransformNode.cpp @@ -16,8 +16,9 @@ Transform MyAvatarHeadTransformNode::getTransform() { auto myAvatar = DependencyManager::get()->getMyAvatar(); glm::vec3 pos = myAvatar->getHeadPosition(); + glm::vec3 scale = glm::vec3(myAvatar->scaleForChildren()); glm::quat headOri = myAvatar->getHeadOrientation(); glm::quat ori = headOri * glm::angleAxis(-PI / 2.0f, Vectors::RIGHT); - return Transform(ori, glm::vec3(1.0f), pos); + return Transform(ori, scale, pos); } \ No newline at end of file From 714cfc5ef12f0cac1966306f0ec047edcf800f4b Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 12:08:27 -0700 Subject: [PATCH 09/15] Add scaling information to CollisionRegion jsdoc and missing info to CollisionPickProperties jsdoc --- interface/src/raypick/PickScriptingInterface.cpp | 13 ++++++++++--- libraries/shared/src/RegisteredMetaTypes.h | 5 +++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 6b8a2d0d7a..b892c6da8e 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -263,9 +263,16 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti * A set of properties that can be passed to {@link Picks.createPick} to create a new Collision Pick. * @typedef {object} Picks.CollisionPickProperties -* @property {Shape} shape - The information about the collision region's size and shape. -* @property {Vec3} position - The position of the collision region. -* @property {Quat} orientation - The orientation of the collision region. +* @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results. +* @property {number} [filter=Picks.PICK_NOTHING] The filter for this Pick to use, constructed using filter flags combined using bitwise OR. +* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are relative to a parent if defined. +* @property {Vec3} position - The position of the collision region, relative to a parent if defined. +* @property {Quat} orientation - The orientation of the collision region, relative to a parent if defined. +* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region, relative to a parent if defined. +* For overlay and entity parents, this is relative to the parent's largest dimension. +* @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. +* @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) +* @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. */ unsigned int PickScriptingInterface::createCollisionPick(const QVariant& properties) { QVariantMap propMap = properties.toMap(); diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h index 02f5fa570c..79adce0a39 100644 --- a/libraries/shared/src/RegisteredMetaTypes.h +++ b/libraries/shared/src/RegisteredMetaTypes.h @@ -259,10 +259,11 @@ public: * A CollisionRegion defines a volume for checking collisions in the physics simulation. * @typedef {object} CollisionRegion -* @property {Shape} shape - The information about the collision region's size and shape. +* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are relative to a parent if defined. * @property {Vec3} position - The position of the collision region, relative to a parent if defined. * @property {Quat} orientation - The orientation of the collision region, relative to a parent if defined. -* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region. +* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region, relative to a parent if defined. +* For overlay and entity parents, this is relative to the parent's largest dimension. * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. * @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. From 836f810c419b1981da284aead6df1187910a7bc0 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 14:11:42 -0700 Subject: [PATCH 10/15] Have OverlayTransformNode and similar define scale relative to nestable scale on creation time, and refactor code --- .../src/raypick/PickScriptingInterface.cpp | 4 ++ .../src/ui/overlays/OverlayTransformNode.cpp | 22 +--------- .../src/ui/overlays/OverlayTransformNode.h | 11 ++--- .../avatars-renderer/AvatarTransformNode.cpp | 22 +--------- .../avatars-renderer/AvatarTransformNode.h | 11 ++--- .../entities/src/EntityTransformNode.cpp | 22 +--------- libraries/entities/src/EntityTransformNode.h | 11 ++--- .../shared/src/NestableTransformNode.cpp | 22 +--------- libraries/shared/src/NestableTransformNode.h | 44 +++++++++++++++++-- 9 files changed, 61 insertions(+), 108 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index b892c6da8e..247df2b11e 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -383,6 +383,10 @@ std::shared_ptr PickScriptingInterface::createTransformNode(const if (propMap["parentJointIndex"].isValid()) { parentJointIndex = propMap["parentJointIndex"].toInt(); } + glm::vec3 baseScale = glm::vec3(1); + if (propMap["baseScale"].isValid()) { + baseScale = vec3FromVariant(propMap["baseScale"]); + } auto sharedNestablePointer = nestablePointer.lock(); if (success && sharedNestablePointer) { NestableType nestableType = sharedNestablePointer->getNestableType(); diff --git a/interface/src/ui/overlays/OverlayTransformNode.cpp b/interface/src/ui/overlays/OverlayTransformNode.cpp index d0a6618e37..fa499b3ce3 100644 --- a/interface/src/ui/overlays/OverlayTransformNode.cpp +++ b/interface/src/ui/overlays/OverlayTransformNode.cpp @@ -7,24 +7,6 @@ // #include "OverlayTransformNode.h" -OverlayTransformNode::OverlayTransformNode(std::weak_ptr overlay, int jointIndex) : - _overlay(overlay), - _jointIndex(jointIndex) -{} - -Transform OverlayTransformNode::getTransform() { - auto overlay = _overlay.lock(); - if (!overlay) { - return Transform(); - } - - bool success; - Transform jointWorldTransform = overlay->getTransform(_jointIndex, success); - if (!success) { - return Transform(); - } - - jointWorldTransform.setScale(overlay->getBounds().getScale()); - - return jointWorldTransform; +glm::vec3 BaseNestableTransformNode::getActualScale(const std::shared_ptr& nestablePointer) const { + return nestablePointer->getBounds().getScale(); } \ No newline at end of file diff --git a/interface/src/ui/overlays/OverlayTransformNode.h b/interface/src/ui/overlays/OverlayTransformNode.h index b9ea9f72c4..11c3415828 100644 --- a/interface/src/ui/overlays/OverlayTransformNode.h +++ b/interface/src/ui/overlays/OverlayTransformNode.h @@ -8,19 +8,14 @@ #ifndef hifi_OverlayTransformNode_h #define hifi_OverlayTransformNode_h -#include "TransformNode.h" +#include "NestableTransformNode.h" #include "Base3DOverlay.h" // For 3D overlays only -class OverlayTransformNode : public TransformNode { +class OverlayTransformNode : public BaseNestableTransformNode { public: - OverlayTransformNode(std::weak_ptr overlay, int jointIndex); - Transform getTransform() override; - -protected: - std::weak_ptr _overlay; - int _jointIndex; + OverlayTransformNode(std::weak_ptr spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {}; }; #endif // hifi_OverlayTransformNode_h \ No newline at end of file diff --git a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp index fc5ba5bc1a..bc24b8a570 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp @@ -7,24 +7,6 @@ // #include "AvatarTransformNode.h" -AvatarTransformNode::AvatarTransformNode(AvatarWeakPointer avatar, int jointIndex) : - _avatar(avatar), - _jointIndex(jointIndex) -{} - -Transform AvatarTransformNode::getTransform() { - auto avatar = _avatar.lock(); - if (!avatar) { - return Transform(); - } - - bool success; - Transform jointWorldTransform = avatar->getTransform(_jointIndex, success); - if (!success) { - return Transform(); - } - - jointWorldTransform.setScale(avatar->scaleForChildren()); - - return jointWorldTransform; +glm::vec3 BaseNestableTransformNode::getActualScale(const std::shared_ptr& nestablePointer) const { + return nestablePointer->scaleForChildren(); } \ No newline at end of file diff --git a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h index 03191b8dbe..183e4ab05c 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h +++ b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.h @@ -8,18 +8,13 @@ #ifndef hifi_AvatarTransformNode_h #define hifi_AvatarTransformNode_h -#include "TransformNode.h" +#include "NestableTransformNode.h" #include "Avatar.h" -class AvatarTransformNode : public TransformNode { +class AvatarTransformNode : public BaseNestableTransformNode { public: - AvatarTransformNode(AvatarWeakPointer avatar, int jointIndex); - Transform getTransform() override; - -protected: - AvatarWeakPointer _avatar; - int _jointIndex; + AvatarTransformNode(std::weak_ptr spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {}; }; #endif // hifi_AvatarTransformNode_h \ No newline at end of file diff --git a/libraries/entities/src/EntityTransformNode.cpp b/libraries/entities/src/EntityTransformNode.cpp index 5b0a690619..35f4d8e52f 100644 --- a/libraries/entities/src/EntityTransformNode.cpp +++ b/libraries/entities/src/EntityTransformNode.cpp @@ -7,24 +7,6 @@ // #include "EntityTransformNode.h" -EntityTransformNode::EntityTransformNode(EntityItemWeakPointer entity, int jointIndex) : - _entity(entity), - _jointIndex(jointIndex) -{} - -Transform EntityTransformNode::getTransform() { - auto entity = _entity.lock(); - if (!entity) { - return Transform(); - } - - bool success; - Transform jointWorldTransform = entity->getTransform(_jointIndex, success); - if (!success) { - return Transform(); - } - - jointWorldTransform.setScale(entity->getScaledDimensions()); - - return jointWorldTransform; +glm::vec3 BaseNestableTransformNode::getActualScale(const std::shared_ptr& nestablePointer) const { + return nestablePointer->getScaledDimensions(); } \ No newline at end of file diff --git a/libraries/entities/src/EntityTransformNode.h b/libraries/entities/src/EntityTransformNode.h index b7388600df..07818f99f3 100644 --- a/libraries/entities/src/EntityTransformNode.h +++ b/libraries/entities/src/EntityTransformNode.h @@ -8,18 +8,13 @@ #ifndef hifi_EntityTransformNode_h #define hifi_EntityTransformNode_h -#include "TransformNode.h" +#include "NestableTransformNode.h" #include "EntityItem.h" -class EntityTransformNode : public TransformNode { +class EntityTransformNode : public BaseNestableTransformNode { public: - EntityTransformNode(EntityItemWeakPointer entity, int jointIndex); - Transform getTransform() override; - -protected: - EntityItemWeakPointer _entity; - int _jointIndex; + EntityTransformNode(std::weak_ptr spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {}; }; #endif // hifi_EntityTransformNode_h \ No newline at end of file diff --git a/libraries/shared/src/NestableTransformNode.cpp b/libraries/shared/src/NestableTransformNode.cpp index 17456d69ce..9da2c85aa3 100644 --- a/libraries/shared/src/NestableTransformNode.cpp +++ b/libraries/shared/src/NestableTransformNode.cpp @@ -8,24 +8,6 @@ #include "NestableTransformNode.h" -NestableTransformNode::NestableTransformNode(SpatiallyNestableWeakPointer spatiallyNestable, int jointIndex) : - _spatiallyNestable(spatiallyNestable), - _jointIndex(jointIndex) -{ -} - -Transform NestableTransformNode::getTransform() { - auto nestable = _spatiallyNestable.lock(); - if (!nestable) { - return Transform(); - } - - bool success; - Transform jointWorldTransform = nestable->getTransform(_jointIndex, success); - - if (success) { - return jointWorldTransform; - } else { - return Transform(); - } +glm::vec3 BaseNestableTransformNode::getActualScale(const std::shared_ptr& nestablePointer) const { + return nestablePointer->getAbsoluteJointScaleInObjectFrame(_jointIndex); } \ No newline at end of file diff --git a/libraries/shared/src/NestableTransformNode.h b/libraries/shared/src/NestableTransformNode.h index 131de9e786..21efd1c690 100644 --- a/libraries/shared/src/NestableTransformNode.h +++ b/libraries/shared/src/NestableTransformNode.h @@ -12,14 +12,50 @@ #include "SpatiallyNestable.h" -class NestableTransformNode : public TransformNode { +template +class BaseNestableTransformNode : public TransformNode { public: - NestableTransformNode(SpatiallyNestableWeakPointer spatiallyNestable, int jointIndex); - Transform getTransform() override; + BaseNestableTransformNode(std::weak_ptr spatiallyNestable, int jointIndex) : + _spatiallyNestable(spatiallyNestable), + _jointIndex(jointIndex) { + auto nestablePointer = _spatiallyNestable.lock(); + if (nestablePointer) { + glm::vec3 nestableDimensions = getActualScale(nestablePointer); + if (!glm::any(glm::equal(nestableDimensions, glm::vec3(0.0f)))) { + _baseScale = nestableDimensions; + } + } + } + + Transform getTransform() { + std::shared_ptr nestable = _spatiallyNestable.lock(); + if (!nestable) { + return Transform(); + } + + bool success; + Transform jointWorldTransform = nestable->getTransform(_jointIndex, success); + + if (!success) { + return Transform(); + } + + jointWorldTransform.setScale(getActualScale(nestable) / _baseScale); + + return jointWorldTransform; + } + + glm::vec3 getActualScale(const std::shared_ptr& nestablePointer) const; protected: - SpatiallyNestableWeakPointer _spatiallyNestable; + std::weak_ptr _spatiallyNestable; int _jointIndex; + glm::vec3 _baseScale { 1.0f }; +}; + +class NestableTransformNode : public BaseNestableTransformNode { +public: + NestableTransformNode(std::weak_ptr spatiallyNestable, int jointIndex) : BaseNestableTransformNode(spatiallyNestable, jointIndex) {}; }; #endif // hifi_NestableTransformNode_h \ No newline at end of file From 23a6abbaca6f36726d81c3072a74bc0b9f79ce6b Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 16:47:09 -0700 Subject: [PATCH 11/15] Update jsdocs to reflect new collision pick scaling behavior --- interface/src/raypick/PickScriptingInterface.cpp | 6 +++--- libraries/shared/src/RegisteredMetaTypes.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 247df2b11e..41669c9f0c 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -265,11 +265,11 @@ unsigned int PickScriptingInterface::createParabolaPick(const QVariant& properti * @typedef {object} Picks.CollisionPickProperties * @property {boolean} [enabled=false] If this Pick should start enabled or not. Disabled Picks do not updated their pick results. * @property {number} [filter=Picks.PICK_NOTHING] The filter for this Pick to use, constructed using filter flags combined using bitwise OR. -* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are relative to a parent if defined. +* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are in world space, but will scale with the parent if defined. * @property {Vec3} position - The position of the collision region, relative to a parent if defined. * @property {Quat} orientation - The orientation of the collision region, relative to a parent if defined. -* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region, relative to a parent if defined. -* For overlay and entity parents, this is relative to the parent's largest dimension. +* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region. +* The depth is measured in world space, but will scale with the parent if defined. * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. * @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. diff --git a/libraries/shared/src/RegisteredMetaTypes.h b/libraries/shared/src/RegisteredMetaTypes.h index 79adce0a39..d59c58def8 100644 --- a/libraries/shared/src/RegisteredMetaTypes.h +++ b/libraries/shared/src/RegisteredMetaTypes.h @@ -259,11 +259,11 @@ public: * A CollisionRegion defines a volume for checking collisions in the physics simulation. * @typedef {object} CollisionRegion -* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are relative to a parent if defined. +* @property {Shape} shape - The information about the collision region's size and shape. Dimensions are in world space, but will scale with the parent if defined. * @property {Vec3} position - The position of the collision region, relative to a parent if defined. * @property {Quat} orientation - The orientation of the collision region, relative to a parent if defined. -* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region, relative to a parent if defined. -* For overlay and entity parents, this is relative to the parent's largest dimension. +* @property {float} threshold - The approximate minimum penetration depth for a test object to be considered in contact with the collision region. +* The depth is measured in world space, but will scale with the parent if defined. * @property {Uuid} parentID - The ID of the parent, either an avatar, an entity, or an overlay. * @property {number} parentJointIndex - The joint of the parent to parent to, for example, the joints on the model of an avatar. (default = 0, no joint) * @property {string} joint - If "Mouse," parents the pick to the mouse. If "Avatar," parents the pick to MyAvatar's head. Otherwise, parents to the joint of the given name on MyAvatar. From 7a9480723e61f58065acaeaaccdd72ec1b4ef393 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 17:30:29 -0700 Subject: [PATCH 12/15] Remove unused variable in PickScriptingInterface::createTransformNode --- interface/src/raypick/PickScriptingInterface.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 41669c9f0c..0273b084b2 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -383,10 +383,6 @@ std::shared_ptr PickScriptingInterface::createTransformNode(const if (propMap["parentJointIndex"].isValid()) { parentJointIndex = propMap["parentJointIndex"].toInt(); } - glm::vec3 baseScale = glm::vec3(1); - if (propMap["baseScale"].isValid()) { - baseScale = vec3FromVariant(propMap["baseScale"]); - } auto sharedNestablePointer = nestablePointer.lock(); if (success && sharedNestablePointer) { NestableType nestableType = sharedNestablePointer->getNestableType(); From f40f40e135c8fbe205e9e7a8476304f94c086f30 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 17:35:12 -0700 Subject: [PATCH 13/15] Use more reasonable value for BaseNestableTransformNode::_baseScale when given bad value --- libraries/shared/src/NestableTransformNode.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/shared/src/NestableTransformNode.h b/libraries/shared/src/NestableTransformNode.h index 21efd1c690..e73360d872 100644 --- a/libraries/shared/src/NestableTransformNode.h +++ b/libraries/shared/src/NestableTransformNode.h @@ -21,9 +21,7 @@ public: auto nestablePointer = _spatiallyNestable.lock(); if (nestablePointer) { glm::vec3 nestableDimensions = getActualScale(nestablePointer); - if (!glm::any(glm::equal(nestableDimensions, glm::vec3(0.0f)))) { - _baseScale = nestableDimensions; - } + _baseScale = glm::max(glm::vec3(0.001f), nestableDimensions); } } From 52bc09cd2aa29071d4fa56fb792fcc454be81d29 Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 6 Sep 2018 17:44:06 -0700 Subject: [PATCH 14/15] Add override qualifier to BaseNestableTransformNode::getTransform --- libraries/shared/src/NestableTransformNode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/shared/src/NestableTransformNode.h b/libraries/shared/src/NestableTransformNode.h index e73360d872..2f9bc2e985 100644 --- a/libraries/shared/src/NestableTransformNode.h +++ b/libraries/shared/src/NestableTransformNode.h @@ -25,7 +25,7 @@ public: } } - Transform getTransform() { + Transform getTransform() override { std::shared_ptr nestable = _spatiallyNestable.lock(); if (!nestable) { return Transform(); From 8d4c47cf8ed70e7ed8c8bd1955ecdbad93cd293d Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Fri, 7 Sep 2018 08:49:44 -0700 Subject: [PATCH 15/15] Make template specialization of BaseNestableTransformNode explicit --- interface/src/ui/overlays/OverlayTransformNode.cpp | 1 + .../src/avatars-renderer/AvatarTransformNode.cpp | 1 + libraries/entities/src/EntityTransformNode.cpp | 1 + libraries/shared/src/NestableTransformNode.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/interface/src/ui/overlays/OverlayTransformNode.cpp b/interface/src/ui/overlays/OverlayTransformNode.cpp index fa499b3ce3..817b6af305 100644 --- a/interface/src/ui/overlays/OverlayTransformNode.cpp +++ b/interface/src/ui/overlays/OverlayTransformNode.cpp @@ -7,6 +7,7 @@ // #include "OverlayTransformNode.h" +template<> glm::vec3 BaseNestableTransformNode::getActualScale(const std::shared_ptr& nestablePointer) const { return nestablePointer->getBounds().getScale(); } \ No newline at end of file diff --git a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp index bc24b8a570..ca3d4a6062 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/AvatarTransformNode.cpp @@ -7,6 +7,7 @@ // #include "AvatarTransformNode.h" +template<> glm::vec3 BaseNestableTransformNode::getActualScale(const std::shared_ptr& nestablePointer) const { return nestablePointer->scaleForChildren(); } \ No newline at end of file diff --git a/libraries/entities/src/EntityTransformNode.cpp b/libraries/entities/src/EntityTransformNode.cpp index 35f4d8e52f..438ece3840 100644 --- a/libraries/entities/src/EntityTransformNode.cpp +++ b/libraries/entities/src/EntityTransformNode.cpp @@ -7,6 +7,7 @@ // #include "EntityTransformNode.h" +template<> glm::vec3 BaseNestableTransformNode::getActualScale(const std::shared_ptr& nestablePointer) const { return nestablePointer->getScaledDimensions(); } \ No newline at end of file diff --git a/libraries/shared/src/NestableTransformNode.cpp b/libraries/shared/src/NestableTransformNode.cpp index 9da2c85aa3..9723f388f6 100644 --- a/libraries/shared/src/NestableTransformNode.cpp +++ b/libraries/shared/src/NestableTransformNode.cpp @@ -8,6 +8,7 @@ #include "NestableTransformNode.h" +template<> glm::vec3 BaseNestableTransformNode::getActualScale(const std::shared_ptr& nestablePointer) const { return nestablePointer->getAbsoluteJointScaleInObjectFrame(_jointIndex); } \ No newline at end of file