diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 4efc3343d1..f166a780ff 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -441,7 +441,7 @@ void Agent::executeScript() { Transform audioTransform; auto headOrientation = scriptedAvatar->getHeadOrientation(); - audioTransform.setTranslation(scriptedAvatar->getPosition()); + audioTransform.setTranslation(scriptedAvatar->getWorldPosition()); audioTransform.setRotation(headOrientation); QByteArray encodedBuffer; @@ -452,7 +452,7 @@ void Agent::executeScript() { } AbstractAudioInterface::emitAudioPacket(encodedBuffer.data(), encodedBuffer.size(), audioSequenceNumber, - audioTransform, scriptedAvatar->getPosition(), glm::vec3(0), + audioTransform, scriptedAvatar->getWorldPosition(), glm::vec3(0), packetType, _selectedCodecName); }); @@ -742,10 +742,10 @@ void Agent::processAgentAvatarAudio() { audioPacket->writePrimitive(numAvailableSamples); // use the orientation and position of this avatar for the source of this audio - audioPacket->writePrimitive(scriptedAvatar->getPosition()); + audioPacket->writePrimitive(scriptedAvatar->getWorldPosition()); glm::quat headOrientation = scriptedAvatar->getHeadOrientation(); audioPacket->writePrimitive(headOrientation); - audioPacket->writePrimitive(scriptedAvatar->getPosition()); + audioPacket->writePrimitive(scriptedAvatar->getWorldPosition()); audioPacket->writePrimitive(glm::vec3(0)); // no matter what, the loudness should be set to 0 @@ -759,10 +759,10 @@ void Agent::processAgentAvatarAudio() { audioPacket->writePrimitive((quint8)0); // use the orientation and position of this avatar for the source of this audio - audioPacket->writePrimitive(scriptedAvatar->getPosition()); + audioPacket->writePrimitive(scriptedAvatar->getWorldPosition()); glm::quat headOrientation = scriptedAvatar->getHeadOrientation(); audioPacket->writePrimitive(headOrientation); - audioPacket->writePrimitive(scriptedAvatar->getPosition()); + audioPacket->writePrimitive(scriptedAvatar->getWorldPosition()); // HUH? why do we write this twice?? audioPacket->writePrimitive(glm::vec3(0)); QByteArray encodedBuffer; diff --git a/assignment-client/src/avatars/AvatarMixerClientData.h b/assignment-client/src/avatars/AvatarMixerClientData.h index 12b0286088..d5c7784da7 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.h +++ b/assignment-client/src/avatars/AvatarMixerClientData.h @@ -91,7 +91,7 @@ public: void loadJSONStats(QJsonObject& jsonObject) const; - glm::vec3 getPosition() const { return _avatar ? _avatar->getPosition() : glm::vec3(0); } + glm::vec3 getPosition() const { return _avatar ? _avatar->getWorldPosition() : glm::vec3(0); } glm::vec3 getGlobalBoundingBoxCorner() const { return _avatar ? _avatar->getGlobalBoundingBoxCorner() : glm::vec3(0); } bool isRadiusIgnoring(const QUuid& other) const { return _radiusIgnoredOthers.find(other) != _radiusIgnoredOthers.end(); } void addToRadiusIgnoringSet(const QUuid& other) { _radiusIgnoredOthers.insert(other); } diff --git a/assignment-client/src/avatars/AvatarMixerSlave.cpp b/assignment-client/src/avatars/AvatarMixerSlave.cpp index 5d36a6d261..dd045c24ea 100644 --- a/assignment-client/src/avatars/AvatarMixerSlave.cpp +++ b/assignment-client/src/avatars/AvatarMixerSlave.cpp @@ -209,7 +209,7 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node) assert(avatarNode); // we can't have gotten here without the avatarData being a valid key in the map return nodeData->getLastBroadcastTime(avatarNode->getUUID()); }, [&](AvatarSharedPointer avatar)->float{ - glm::vec3 nodeBoxHalfScale = (avatar->getPosition() - avatar->getGlobalBoundingBoxCorner() * avatar->getSensorToWorldScale()); + glm::vec3 nodeBoxHalfScale = (avatar->getWorldPosition() - avatar->getGlobalBoundingBoxCorner() * avatar->getSensorToWorldScale()); return glm::max(nodeBoxHalfScale.x, glm::max(nodeBoxHalfScale.y, nodeBoxHalfScale.z)); }, [&](AvatarSharedPointer avatar)->bool { if (avatar == thisAvatar) { diff --git a/assignment-client/src/avatars/ScriptableAvatar.cpp b/assignment-client/src/avatars/ScriptableAvatar.cpp index 5060891284..c9ded2d6fb 100644 --- a/assignment-client/src/avatars/ScriptableAvatar.cpp +++ b/assignment-client/src/avatars/ScriptableAvatar.cpp @@ -20,7 +20,7 @@ QByteArray ScriptableAvatar::toByteArrayStateful(AvatarDataDetail dataDetail, bool dropFaceTracking) { - _globalPosition = getPosition(); + _globalPosition = getWorldPosition(); return AvatarData::toByteArrayStateful(dataDetail); } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f2bb52ea47..b1f461f227 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -893,7 +893,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo connect(audioIO.data(), &AudioClient::muteEnvironmentRequested, [](glm::vec3 position, float radius) { auto audioClient = DependencyManager::get(); auto audioScriptingInterface = DependencyManager::get(); - auto myAvatarPosition = DependencyManager::get()->getMyAvatar()->getPosition(); + auto myAvatarPosition = DependencyManager::get()->getMyAvatar()->getWorldPosition(); float distance = glm::distance(myAvatarPosition, position); bool shouldMute = !audioClient->isMuted() && (distance < radius); @@ -966,7 +966,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo auto addressManager = DependencyManager::get(); // use our MyAvatar position and quat for address manager path - addressManager->setPositionGetter([this]{ return getMyAvatar()->getPosition(); }); + addressManager->setPositionGetter([this]{ return getMyAvatar()->getWorldPosition(); }); addressManager->setOrientationGetter([this]{ return getMyAvatar()->getOrientation(); }); connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle); @@ -1501,7 +1501,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo static const QString FAST_STATS_ARG = "--fast-heartbeat"; static int SEND_STATS_INTERVAL_MS = arguments().indexOf(FAST_STATS_ARG) != -1 ? 1000 : 10000; - static glm::vec3 lastAvatarPosition = myAvatar->getPosition(); + static glm::vec3 lastAvatarPosition = myAvatar->getWorldPosition(); static glm::mat4 lastHMDHeadPose = getHMDSensorPose(); static controller::Pose lastLeftHandPose = myAvatar->getLeftHandPose(); static controller::Pose lastRightHandPose = myAvatar->getRightHandPose(); @@ -1629,7 +1629,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo properties["bytes_downloaded"] = bytesDownloaded; auto myAvatar = getMyAvatar(); - glm::vec3 avatarPosition = myAvatar->getPosition(); + glm::vec3 avatarPosition = myAvatar->getWorldPosition(); properties["avatar_has_moved"] = lastAvatarPosition != avatarPosition; lastAvatarPosition = avatarPosition; @@ -1711,7 +1711,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo checkNearbyAvatarsTimer->setInterval(CHECK_NEARBY_AVATARS_INTERVAL_MS); // 10 seconds, Qt::CoarseTimer ok connect(checkNearbyAvatarsTimer, &QTimer::timeout, this, [this]() { auto avatarManager = DependencyManager::get(); - int nearbyAvatars = avatarManager->numberOfAvatarsInRange(avatarManager->getMyAvatar()->getPosition(), + int nearbyAvatars = avatarManager->numberOfAvatarsInRange(avatarManager->getMyAvatar()->getWorldPosition(), NEARBY_AVATAR_RADIUS_METERS) - 1; if (nearbyAvatars != lastCountOfNearbyAvatars) { lastCountOfNearbyAvatars = nearbyAvatars; @@ -2455,11 +2455,11 @@ void Application::updateCamera(RenderArgs& renderArgs) { glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); _myCamera.setOrientation(cameraEntity->getRotation() * hmdRotation); glm::vec3 hmdOffset = extractTranslation(myAvatar->getHMDSensorMatrix()); - _myCamera.setPosition(cameraEntity->getPosition() + (hmdRotation * hmdOffset)); + _myCamera.setPosition(cameraEntity->getWorldPosition() + (hmdRotation * hmdOffset)); } else { _myCamera.setOrientation(cameraEntity->getRotation()); - _myCamera.setPosition(cameraEntity->getPosition()); + _myCamera.setPosition(cameraEntity->getWorldPosition()); } } } @@ -3871,7 +3871,7 @@ void Application::idle() { auto entity = getEntities()->getTree()->findEntityByID(_keyboardFocusedEntity.get()); if (entity && _keyboardFocusHighlight) { _keyboardFocusHighlight->setRotation(entity->getRotation()); - _keyboardFocusHighlight->setPosition(entity->getPosition()); + _keyboardFocusHighlight->setWorldPosition(entity->getWorldPosition()); } } else { // Only Web overlays can have focus. @@ -3879,7 +3879,7 @@ void Application::idle() { std::dynamic_pointer_cast(getOverlays().getOverlay(_keyboardFocusedOverlay.get())); if (overlay && _keyboardFocusHighlight) { _keyboardFocusHighlight->setRotation(overlay->getRotation()); - _keyboardFocusHighlight->setPosition(overlay->getPosition()); + _keyboardFocusHighlight->setWorldPosition(overlay->getWorldPosition()); } } } @@ -4013,7 +4013,7 @@ bool Application::exportEntities(const QString& filename, !entityIDs.contains(parentID) || !entityTree->findEntityByEntityItemID(parentID))) { // If parent wasn't selected, we want absolute position, which isn't in properties. - auto position = entityItem->getPosition(); + auto position = entityItem->getWorldPosition(); root.x = glm::min(root.x, position.x); root.y = glm::min(root.y, position.y); root.z = glm::min(root.z, position.z); @@ -4216,7 +4216,7 @@ void Application::init() { return 0.0f; } - auto distance = glm::distance(getMyAvatar()->getPosition(), item.getPosition()); + auto distance = glm::distance(getMyAvatar()->getWorldPosition(), item.getWorldPosition()); return atan2(maxSize, distance); }); @@ -4520,7 +4520,7 @@ void Application::setKeyboardFocusHighlight(const glm::vec3& position, const glm // Position focus _keyboardFocusHighlight->setRotation(rotation); - _keyboardFocusHighlight->setPosition(position); + _keyboardFocusHighlight->setWorldPosition(position); _keyboardFocusHighlight->setDimensions(dimensions); _keyboardFocusHighlight->setVisible(true); } @@ -4557,7 +4557,7 @@ void Application::setKeyboardFocusEntity(const EntityItemID& entityItemID) { } _lastAcceptedKeyPress = usecTimestampNow(); - setKeyboardFocusHighlight(entity->getPosition(), entity->getRotation(), + setKeyboardFocusHighlight(entity->getWorldPosition(), entity->getRotation(), entity->getDimensions() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR); } } @@ -4594,7 +4594,7 @@ void Application::setKeyboardFocusOverlay(const OverlayID& overlayID) { if (overlay->getProperty("showKeyboardFocusHighlight").toBool()) { auto size = overlay->getSize() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR; const float OVERLAY_DEPTH = 0.0105f; - setKeyboardFocusHighlight(overlay->getPosition(), overlay->getRotation(), glm::vec3(size.x, size.y, OVERLAY_DEPTH)); + setKeyboardFocusHighlight(overlay->getWorldPosition(), overlay->getRotation(), glm::vec3(size.x, size.y, OVERLAY_DEPTH)); } else if (_keyboardFocusHighlight) { _keyboardFocusHighlight->setVisible(false); } @@ -4686,7 +4686,7 @@ void Application::update(float deltaTime) { controller::InputCalibrationData calibrationData = { myAvatar->getSensorToWorldMatrix(), - createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()), + createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getWorldPosition()), myAvatar->getHMDSensorMatrix(), myAvatar->getCenterEyeCalibrationMat(), myAvatar->getHeadCalibrationMat(), @@ -4796,7 +4796,7 @@ void Application::update(float deltaTime) { }; // copy controller poses from userInputMapper to myAvatar. - glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()); + glm::mat4 myAvatarMatrix = createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getWorldPosition()); glm::mat4 worldToSensorMatrix = glm::inverse(myAvatar->getSensorToWorldMatrix()); glm::mat4 avatarToSensorMatrix = worldToSensorMatrix * myAvatarMatrix; for (auto& action : avatarControllerActions) { @@ -5412,7 +5412,7 @@ std::shared_ptr Application::getMyAvatar() const { } glm::vec3 Application::getAvatarPosition() const { - return getMyAvatar()->getPosition(); + return getMyAvatar()->getWorldPosition(); } void Application::copyViewFrustum(ViewFrustum& viewOut) const { @@ -5624,7 +5624,7 @@ bool Application::nearbyEntitiesAreReadyForPhysics() { // whose bounding boxes cannot be computed (it is too loose for our purposes here). Instead we manufacture // custom filters and use the general-purpose EntityTree::findEntities(filter, ...) QVector entities; - AABox avatarBox(getMyAvatar()->getPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE)); + AABox avatarBox(getMyAvatar()->getWorldPosition() - glm::vec3(PHYSICS_READY_RANGE), glm::vec3(2 * PHYSICS_READY_RANGE)); // create two functions that use avatarBox (entityScan and elementScan), the second calls the first std::function entityScan = [=](EntityItemPointer& entity) { if (entity->shouldBePhysical()) { @@ -6438,7 +6438,7 @@ void Application::addAssetToWorldAddEntity(QString filePath, QString mapping) { properties.setCollisionless(true); // Temporarily set so that doesn't collide with avatar. properties.setVisible(false); // Temporarily set so that don't see at large unresized dimensions. glm::vec3 positionOffset = getMyAvatar()->getOrientation() * (getMyAvatar()->getSensorToWorldScale() * glm::vec3(0.0f, 0.0f, -2.0f)); - properties.setPosition(getMyAvatar()->getPosition() + positionOffset); + properties.setPosition(getMyAvatar()->getWorldPosition() + positionOffset); properties.setRotation(getMyAvatar()->getOrientation()); properties.setGravity(glm::vec3(0.0f, 0.0f, 0.0f)); auto entityID = DependencyManager::get()->addEntity(properties); diff --git a/interface/src/avatar/AvatarActionHold.cpp b/interface/src/avatar/AvatarActionHold.cpp index a47bbbad1b..668994883d 100644 --- a/interface/src/avatar/AvatarActionHold.cpp +++ b/interface/src/avatar/AvatarActionHold.cpp @@ -529,7 +529,7 @@ void AvatarActionHold::lateAvatarUpdate(const AnimPose& prePhysicsRoomPose, cons rigidBody->setWorldTransform(worldTrans); bool positionSuccess; - ownerEntity->setPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset(), positionSuccess, false); + ownerEntity->setWorldPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset(), positionSuccess, false); bool orientationSuccess; ownerEntity->setOrientation(bulletToGLM(worldTrans.getRotation()), orientationSuccess, false); } diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index e8b800db69..d9d56b76b1 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -435,7 +435,7 @@ void AvatarManager::handleCollisionEvents(const CollisionEvents& collisionEvents static const int MAX_INJECTOR_COUNT = 3; if (_collisionInjectors.size() < MAX_INJECTOR_COUNT) { auto injector = AudioInjector::playSound(collisionSound, energyFactorOfFull, AVATAR_STRETCH_FACTOR, - myAvatar->getPosition()); + myAvatar->getWorldPosition()); _collisionInjectors.emplace_back(injector); } myAvatar->collisionWithEntity(collision); diff --git a/interface/src/avatar/AvatarManager.h b/interface/src/avatar/AvatarManager.h index 39a4f7a4af..fc93bbbfe3 100644 --- a/interface/src/avatar/AvatarManager.h +++ b/interface/src/avatar/AvatarManager.h @@ -41,7 +41,7 @@ public: void init(); std::shared_ptr getMyAvatar() { return _myAvatar; } - glm::vec3 getMyAvatarPosition() const { return _myAvatar->getPosition(); } + glm::vec3 getMyAvatarPosition() const { return _myAvatar->getWorldPosition(); } // Null/Default-constructed QUuids will return MyAvatar Q_INVOKABLE virtual ScriptAvatarData* getAvatar(QUuid avatarID) override { return new ScriptAvatar(getAvatarBySessionID(avatarID)); } diff --git a/interface/src/avatar/AvatarMotionState.cpp b/interface/src/avatar/AvatarMotionState.cpp index 91c83afcbd..01cfb93333 100644 --- a/interface/src/avatar/AvatarMotionState.cpp +++ b/interface/src/avatar/AvatarMotionState.cpp @@ -106,7 +106,7 @@ float AvatarMotionState::getObjectAngularDamping() const { // virtual glm::vec3 AvatarMotionState::getObjectPosition() const { - return _avatar->getPosition(); + return _avatar->getWorldPosition(); } // virtual diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 3189ad3c77..9458789685 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -196,7 +196,7 @@ MyAvatar::MyAvatar(QThread* thread) : setDisplayName(dummyAvatar.getDisplayName()); } - setPosition(dummyAvatar.getPosition()); + setWorldPosition(dummyAvatar.getWorldPosition()); setOrientation(dummyAvatar.getOrientation()); if (!dummyAvatar.getAttachmentData().isEmpty()) { @@ -276,7 +276,7 @@ void MyAvatar::simulateAttachments(float deltaTime) { QByteArray MyAvatar::toByteArrayStateful(AvatarDataDetail dataDetail, bool dropFaceTracking) { CameraMode mode = qApp->getCamera().getMode(); - _globalPosition = getPosition(); + _globalPosition = getWorldPosition(); // This might not be right! Isn't the capsule local offset in avatar space, and don't we need to add the radius to the y as well? -HRS 5/26/17 _globalBoundingBoxDimensions.x = _characterController.getCapsuleRadius(); _globalBoundingBoxDimensions.y = _characterController.getCapsuleHalfHeight(); @@ -284,11 +284,11 @@ QByteArray MyAvatar::toByteArrayStateful(AvatarDataDetail dataDetail, bool dropF _globalBoundingBoxOffset = _characterController.getCapsuleLocalOffset(); if (mode == CAMERA_MODE_THIRD_PERSON || mode == CAMERA_MODE_INDEPENDENT) { // fake the avatar position that is sent up to the AvatarMixer - glm::vec3 oldPosition = getPosition(); - setPosition(getSkeletonPosition()); + glm::vec3 oldPosition = getWorldPosition(); + setWorldPosition(getSkeletonPosition()); QByteArray array = AvatarData::toByteArrayStateful(dataDetail); // copy the correct position back - setPosition(oldPosition); + setWorldPosition(oldPosition); return array; } return AvatarData::toByteArrayStateful(dataDetail); @@ -321,14 +321,14 @@ void MyAvatar::centerBody() { if (_characterController.getState() == CharacterController::State::Ground) { // the avatar's physical aspect thinks it is standing on something // therefore need to be careful to not "center" the body below the floor - float downStep = glm::dot(worldBodyPos - getPosition(), _worldUpDirection); + float downStep = glm::dot(worldBodyPos - getWorldPosition(), _worldUpDirection); if (downStep < -0.5f * _characterController.getCapsuleHalfHeight() + _characterController.getCapsuleRadius()) { worldBodyPos -= downStep * _worldUpDirection; } } // this will become our new position. - setPosition(worldBodyPos); + setWorldPosition(worldBodyPos); setOrientation(worldBodyRot); // reset the body in sensor space @@ -372,7 +372,7 @@ void MyAvatar::reset(bool andRecenter, bool andReload, bool andHead) { auto worldBodyRot = glmExtractRotation(worldBodyMatrix); // this will become our new position. - setPosition(worldBodyPos); + setWorldPosition(worldBodyPos); setOrientation(worldBodyRot); // now sample the new hmd orientation AFTER sensor reset, which should be identity. @@ -410,7 +410,7 @@ void MyAvatar::update(float deltaTime) { #endif if (_goToPending) { - setPosition(_goToPosition); + setWorldPosition(_goToPosition); setOrientation(_goToOrientation); _headControllerFacingMovingAverage = _headControllerFacing; // reset moving average _goToPending = false; @@ -444,7 +444,7 @@ void MyAvatar::update(float deltaTime) { // This might not be right! Isn't the capsule local offset in avatar space? -HRS 5/26/17 halfBoundingBoxDimensions += _characterController.getCapsuleLocalOffset(); QMetaObject::invokeMethod(audio.data(), "setAvatarBoundingBoxParameters", - Q_ARG(glm::vec3, (getPosition() - halfBoundingBoxDimensions)), + Q_ARG(glm::vec3, (getWorldPosition() - halfBoundingBoxDimensions)), Q_ARG(glm::vec3, (halfBoundingBoxDimensions*2.0f))); if (getIdentityDataChanged()) { @@ -537,7 +537,7 @@ void MyAvatar::simulate(float deltaTime) { if (!_skeletonModel->hasSkeleton()) { // All the simulation that can be done has been done - getHead()->setPosition(getPosition()); // so audio-position isn't 0,0,0 + getHead()->setPosition(getWorldPosition()); // so audio-position isn't 0,0,0 return; } @@ -555,7 +555,7 @@ void MyAvatar::simulate(float deltaTime) { Head* head = getHead(); glm::vec3 headPosition; if (!_skeletonModel->getHeadPosition(headPosition)) { - headPosition = getPosition(); + headPosition = getWorldPosition(); } head->setPosition(headPosition); head->setScale(getModelScale()); @@ -666,7 +666,7 @@ void MyAvatar::updateSensorToWorldMatrix() { // update the sensor mat so that the body position will end up in the desired // position when driven from the head. float sensorToWorldScale = getEyeHeight() / getUserEyeHeight(); - glm::mat4 desiredMat = createMatFromScaleQuatAndPos(glm::vec3(sensorToWorldScale), getOrientation(), getPosition()); + glm::mat4 desiredMat = createMatFromScaleQuatAndPos(glm::vec3(sensorToWorldScale), getOrientation(), getWorldPosition()); _sensorToWorldMatrix = desiredMat * glm::inverse(_bodySensorMatrix); lateUpdatePalms(); @@ -783,7 +783,7 @@ controller::Pose MyAvatar::getRightHandTipPose() const { } glm::vec3 MyAvatar::worldToJointPoint(const glm::vec3& position, const int jointIndex) const { - glm::vec3 jointPos = getPosition();//default value if no or invalid joint specified + glm::vec3 jointPos = getWorldPosition();//default value if no or invalid joint specified glm::quat jointRot = getRotation();//default value if no or invalid joint specified if (jointIndex != -1) { if (_skeletonModel->getJointPositionInWorldFrame(jointIndex, jointPos)) { @@ -818,7 +818,7 @@ glm::quat MyAvatar::worldToJointRotation(const glm::quat& worldRot, const int jo } glm::vec3 MyAvatar::jointToWorldPoint(const glm::vec3& jointSpacePos, const int jointIndex) const { - glm::vec3 jointPos = getPosition();//default value if no or invalid joint specified + glm::vec3 jointPos = getWorldPosition();//default value if no or invalid joint specified glm::quat jointRot = getRotation();//default value if no or invalid joint specified if (jointIndex != -1) { @@ -1230,7 +1230,7 @@ void MyAvatar::updateLookAtTargetAvatar() { float angleTo = coneSphereAngle(getHead()->getEyePosition(), lookForward, avatar->getHead()->getEyePosition(), radius); if (angleTo < (smallestAngleTo * (isCurrentTarget ? KEEP_LOOKING_AT_CURRENT_ANGLE_FACTOR : 1.0f))) { _lookAtTargetAvatar = avatarPointer; - _targetAvatarPosition = avatarPointer->getPosition(); + _targetAvatarPosition = avatarPointer->getWorldPosition(); } if (_lookAtSnappingEnabled && avatar->getLookAtSnappingEnabled() && isLookingAtMe(avatar)) { @@ -1301,7 +1301,7 @@ eyeContactTarget MyAvatar::getEyeContactTarget() { } glm::vec3 MyAvatar::getDefaultEyePosition() const { - return getPosition() + getOrientation() * Quaternions::Y_180 * _skeletonModel->getDefaultEyeModelPosition(); + return getWorldPosition() + getOrientation() * Quaternions::Y_180 * _skeletonModel->getDefaultEyeModelPosition(); } const float SCRIPT_PRIORITY = 1.0f + 1.0f; @@ -1460,9 +1460,9 @@ glm::vec3 MyAvatar::getSkeletonPosition() const { // The avatar is rotated PI about the yAxis, so we have to correct for it // to get the skeleton offset contribution in the world-frame. const glm::quat FLIP = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f)); - return getPosition() + getOrientation() * FLIP * _skeletonOffset; + return getWorldPosition() + getOrientation() * FLIP * _skeletonOffset; } - return Avatar::getPosition(); + return Avatar::getWorldPosition(); } void MyAvatar::rebuildCollisionShape() { @@ -1508,7 +1508,7 @@ controller::Pose MyAvatar::getControllerPoseInWorldFrame(controller::Action acti controller::Pose MyAvatar::getControllerPoseInAvatarFrame(controller::Action action) const { auto pose = getControllerPoseInWorldFrame(action); if (pose.valid) { - glm::mat4 invAvatarMatrix = glm::inverse(createMatFromQuatAndPos(getOrientation(), getPosition())); + glm::mat4 invAvatarMatrix = glm::inverse(createMatFromQuatAndPos(getOrientation(), getWorldPosition())); return pose.transform(invAvatarMatrix); } else { return controller::Pose(); // invalid pose @@ -1575,7 +1575,7 @@ void MyAvatar::prepareForPhysicsSimulation() { _characterController.setParentVelocity(parentVelocity); _characterController.setScaleFactor(getSensorToWorldScale()); - _characterController.setPositionAndOrientation(getPosition(), getOrientation()); + _characterController.setPositionAndOrientation(getWorldPosition(), getOrientation()); auto headPose = getControllerPoseInAvatarFrame(controller::Action::HEAD); if (headPose.isValid()) { _follow.prePhysicsUpdate(*this, deriveBodyFromHMDSensor(), _bodySensorMatrix, hasDriveInput()); @@ -1609,7 +1609,7 @@ void MyAvatar::harvestResultsFromPhysicsSimulation(float deltaTime) { if (_characterController.isEnabledAndReady()) { _characterController.getPositionAndOrientation(position, orientation); } else { - position = getPosition(); + position = getWorldPosition(); orientation = getOrientation(); } nextAttitude(position, orientation); @@ -1619,7 +1619,7 @@ void MyAvatar::harvestResultsFromPhysicsSimulation(float deltaTime) { setVelocity(_characterController.getLinearVelocity() + _characterController.getFollowVelocity()); if (_characterController.isStuck()) { _physicsSafetyPending = true; - _goToPosition = getPosition(); + _goToPosition = getWorldPosition(); } } else { setVelocity(getVelocity() + _characterController.getFollowVelocity()); @@ -1846,7 +1846,7 @@ void MyAvatar::postUpdate(float deltaTime, const render::ScenePointer& scene) { } } - DebugDraw::getInstance().updateMyAvatarPos(getPosition()); + DebugDraw::getInstance().updateMyAvatarPos(getWorldPosition()); DebugDraw::getInstance().updateMyAvatarRot(getOrientation()); AnimPose postUpdateRoomPose(_sensorToWorldMatrix); @@ -1854,7 +1854,7 @@ void MyAvatar::postUpdate(float deltaTime, const render::ScenePointer& scene) { updateHoldActions(_prePhysicsRoomPose, postUpdateRoomPose); if (_enableDebugDrawDetailedCollision) { - AnimPose rigToWorldPose(glm::vec3(1.0f), getRotation() * Quaternions::Y_180, getPosition()); + AnimPose rigToWorldPose(glm::vec3(1.0f), getRotation() * Quaternions::Y_180, getWorldPosition()); const int NUM_DEBUG_COLORS = 8; const glm::vec4 DEBUG_COLORS[NUM_DEBUG_COLORS] = { glm::vec4(1.0f, 1.0f, 1.0f, 1.0f), @@ -2105,7 +2105,7 @@ void MyAvatar::updatePosition(float deltaTime) { if (_moving) { // scan for walkability - glm::vec3 position = getPosition(); + glm::vec3 position = getWorldPosition(); MyCharacterController::RayShotgunResult result; glm::vec3 step = deltaTime * (getRotation() * _actionMotorVelocity); _characterController.testRayShotgun(position, step, result); @@ -2916,7 +2916,7 @@ float MyAvatar::getAudioEnergy() { } bool MyAvatar::didTeleport() { - glm::vec3 pos = getPosition(); + glm::vec3 pos = getWorldPosition(); glm::vec3 changeInPosition = pos - lastPosition; lastPosition = pos; return (changeInPosition.length() > MAX_AVATAR_MOVEMENT_PER_FRAME); @@ -2960,7 +2960,7 @@ glm::mat4 MyAvatar::computeCameraRelativeHandControllerMatrix(const glm::mat4& c glm::mat4 controllerWorldMatrix = getSensorToWorldMatrix() * delta * controllerSensorMatrix; // transform controller into avatar space - glm::mat4 avatarMatrix = createMatFromQuatAndPos(getOrientation(), getPosition()); + glm::mat4 avatarMatrix = createMatFromQuatAndPos(getOrientation(), getWorldPosition()); return glm::inverse(avatarMatrix) * controllerWorldMatrix; } diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 16ed9ea5b4..263a2f34c4 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -114,7 +114,7 @@ class MyAvatar : public Avatar { // FIXME: `glm::vec3 position` is not accessible from QML, so this exposes position in a QML-native type Q_PROPERTY(QVector3D qmlPosition READ getQmlPosition) - QVector3D getQmlPosition() { auto p = getPosition(); return QVector3D(p.x, p.y, p.z); } + QVector3D getQmlPosition() { auto p = getWorldPosition(); return QVector3D(p.x, p.y, p.z); } Q_PROPERTY(bool shouldRenderLocally READ getShouldRenderLocally WRITE setShouldRenderLocally) Q_PROPERTY(glm::vec3 motorVelocity READ getScriptedMotorVelocity WRITE setScriptedMotorVelocity) diff --git a/interface/src/avatar/MyCharacterController.cpp b/interface/src/avatar/MyCharacterController.cpp index 761e2e5bff..57b5e96ee5 100755 --- a/interface/src/avatar/MyCharacterController.cpp +++ b/interface/src/avatar/MyCharacterController.cpp @@ -65,7 +65,7 @@ void MyCharacterController::updateShapeIfNecessary() { _rigidBody->setSleepingThresholds(0.0f, 0.0f); _rigidBody->setAngularFactor(0.0f); _rigidBody->setWorldTransform(btTransform(glmToBullet(_avatar->getOrientation()), - glmToBullet(_avatar->getPosition()))); + glmToBullet(_avatar->getWorldPosition()))); _rigidBody->setDamping(0.0f, 0.0f); if (_state == State::Hover) { _rigidBody->setGravity(btVector3(0.0f, 0.0f, 0.0f)); diff --git a/interface/src/raypick/JointRayPick.cpp b/interface/src/raypick/JointRayPick.cpp index cf3f380ca0..fc0ecf94e5 100644 --- a/interface/src/raypick/JointRayPick.cpp +++ b/interface/src/raypick/JointRayPick.cpp @@ -28,7 +28,7 @@ const PickRay JointRayPick::getPickRay(bool& valid) const { if (jointIndex != INVALID_JOINT || useAvatarHead) { glm::vec3 jointPos = useAvatarHead ? myAvatar->getHeadPosition() : myAvatar->getAbsoluteJointTranslationInObjectFrame(jointIndex); glm::quat jointRot = useAvatarHead ? myAvatar->getHeadOrientation() : myAvatar->getAbsoluteJointRotationInObjectFrame(jointIndex); - glm::vec3 avatarPos = myAvatar->getPosition(); + glm::vec3 avatarPos = myAvatar->getWorldPosition(); glm::quat avatarRot = myAvatar->getOrientation(); glm::vec3 pos = useAvatarHead ? jointPos : avatarPos + (avatarRot * jointPos); diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index d4a300c337..4fa5e5726b 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -192,7 +192,7 @@ void Stats::updateStats(bool force) { // Third column, avatar stats auto myAvatar = avatarManager->getMyAvatar(); - glm::vec3 avatarPos = myAvatar->getPosition(); + glm::vec3 avatarPos = myAvatar->getWorldPosition(); STAT_UPDATE(position, QVector3D(avatarPos.x, avatarPos.y, avatarPos.z)); STAT_UPDATE_FLOAT(speed, glm::length(myAvatar->getVelocity()), 0.01f); STAT_UPDATE_FLOAT(yaw, myAvatar->getBodyYaw(), 0.1f); diff --git a/interface/src/ui/overlays/Base3DOverlay.cpp b/interface/src/ui/overlays/Base3DOverlay.cpp index 42425932df..457f06aaa2 100644 --- a/interface/src/ui/overlays/Base3DOverlay.cpp +++ b/interface/src/ui/overlays/Base3DOverlay.cpp @@ -114,7 +114,7 @@ void Base3DOverlay::setProperties(const QVariantMap& originalProperties) { properties["parentJointIndex"] = getParentJointIndex(); } if (!properties["position"].isValid() && !properties["localPosition"].isValid()) { - properties["position"] = vec3toVariant(getPosition()); + properties["position"] = vec3toVariant(getWorldPosition()); } if (!properties["orientation"].isValid() && !properties["localOrientation"].isValid()) { properties["orientation"] = quatToVariant(getOrientation()); @@ -214,7 +214,7 @@ QVariant Base3DOverlay::getProperty(const QString& property) { return _name; } if (property == "position" || property == "start" || property == "p1" || property == "point") { - return vec3toVariant(getPosition()); + return vec3toVariant(getWorldPosition()); } if (property == "localPosition") { return vec3toVariant(getLocalPosition()); diff --git a/interface/src/ui/overlays/Base3DOverlay.h b/interface/src/ui/overlays/Base3DOverlay.h index 436cfbf97b..817e9b2acf 100644 --- a/interface/src/ui/overlays/Base3DOverlay.h +++ b/interface/src/ui/overlays/Base3DOverlay.h @@ -33,7 +33,7 @@ public: virtual bool is3D() const override { return true; } // TODO: consider implementing registration points in this class - glm::vec3 getCenter() const { return getPosition(); } + glm::vec3 getCenter() const { return getWorldPosition(); } float getLineWidth() const { return _lineWidth; } bool getIsSolid() const { return _isSolid; } diff --git a/interface/src/ui/overlays/Circle3DOverlay.cpp b/interface/src/ui/overlays/Circle3DOverlay.cpp index 536b2c764f..88172950ee 100644 --- a/interface/src/ui/overlays/Circle3DOverlay.cpp +++ b/interface/src/ui/overlays/Circle3DOverlay.cpp @@ -415,11 +415,11 @@ bool Circle3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::ve // Scale the dimensions by the diameter glm::vec2 dimensions = getOuterRadius() * 2.0f * getDimensions(); - bool intersects = findRayRectangleIntersection(origin, direction, getRotation(), getPosition(), dimensions, distance); + bool intersects = findRayRectangleIntersection(origin, direction, getRotation(), getWorldPosition(), dimensions, distance); if (intersects) { glm::vec3 hitPosition = origin + (distance * direction); - glm::vec3 localHitPosition = glm::inverse(getRotation()) * (hitPosition - getPosition()); + glm::vec3 localHitPosition = glm::inverse(getRotation()) * (hitPosition - getWorldPosition()); localHitPosition.x /= getDimensions().x; localHitPosition.y /= getDimensions().y; float distanceToHit = glm::length(localHitPosition); diff --git a/interface/src/ui/overlays/ContextOverlayInterface.cpp b/interface/src/ui/overlays/ContextOverlayInterface.cpp index 70b75a0b17..ccbf9fb1b2 100644 --- a/interface/src/ui/overlays/ContextOverlayInterface.cpp +++ b/interface/src/ui/overlays/ContextOverlayInterface.cpp @@ -161,7 +161,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID& _contextOverlay->setIsFacingAvatar(true); _contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay); } - _contextOverlay->setPosition(contextOverlayPosition); + _contextOverlay->setWorldPosition(contextOverlayPosition); _contextOverlay->setDimensions(contextOverlayDimensions); _contextOverlay->setRotation(entityProperties.getRotation()); _contextOverlay->setVisible(true); diff --git a/interface/src/ui/overlays/Cube3DOverlay.cpp b/interface/src/ui/overlays/Cube3DOverlay.cpp index b6df1dbc31..d95b8c7761 100644 --- a/interface/src/ui/overlays/Cube3DOverlay.cpp +++ b/interface/src/ui/overlays/Cube3DOverlay.cpp @@ -144,7 +144,7 @@ QVariant Cube3DOverlay::getProperty(const QString& property) { Transform Cube3DOverlay::evalRenderTransform() { // TODO: handle registration point?? - glm::vec3 position = getPosition(); + glm::vec3 position = getWorldPosition(); glm::vec3 dimensions = getDimensions(); glm::quat rotation = getRotation(); diff --git a/interface/src/ui/overlays/Grid3DOverlay.cpp b/interface/src/ui/overlays/Grid3DOverlay.cpp index ca275368cb..afce710d08 100644 --- a/interface/src/ui/overlays/Grid3DOverlay.cpp +++ b/interface/src/ui/overlays/Grid3DOverlay.cpp @@ -69,7 +69,7 @@ void Grid3DOverlay::render(RenderArgs* args) { auto minCorner = glm::vec2(-0.5f, -0.5f); auto maxCorner = glm::vec2(0.5f, 0.5f); - auto position = getPosition(); + auto position = getWorldPosition(); if (_followCamera) { // Get the camera position rounded to the nearest major grid line // This grid is for UI and should lie on worldlines diff --git a/interface/src/ui/overlays/Line3DOverlay.cpp b/interface/src/ui/overlays/Line3DOverlay.cpp index bdb35d4f49..8869817829 100644 --- a/interface/src/ui/overlays/Line3DOverlay.cpp +++ b/interface/src/ui/overlays/Line3DOverlay.cpp @@ -45,7 +45,7 @@ Line3DOverlay::~Line3DOverlay() { } glm::vec3 Line3DOverlay::getStart() const { - return getPosition(); + return getWorldPosition(); } glm::vec3 Line3DOverlay::getEnd() const { @@ -69,7 +69,7 @@ glm::vec3 Line3DOverlay::getEnd() const { } void Line3DOverlay::setStart(const glm::vec3& start) { - setPosition(start); + setWorldPosition(start); } void Line3DOverlay::setEnd(const glm::vec3& end) { diff --git a/interface/src/ui/overlays/ModelOverlay.cpp b/interface/src/ui/overlays/ModelOverlay.cpp index 2a13249958..eedacd2d67 100644 --- a/interface/src/ui/overlays/ModelOverlay.cpp +++ b/interface/src/ui/overlays/ModelOverlay.cpp @@ -121,7 +121,7 @@ void ModelOverlay::setDrawHUDLayer(bool drawHUDLayer) { } void ModelOverlay::setProperties(const QVariantMap& properties) { - auto origPosition = getPosition(); + auto origPosition = getWorldPosition(); auto origRotation = getRotation(); auto origDimensions = getDimensions(); auto origScale = getSNScale(); @@ -143,7 +143,7 @@ void ModelOverlay::setProperties(const QVariantMap& properties) { _scaleToFit = false; } - if (origPosition != getPosition() || origRotation != getRotation() || origDimensions != getDimensions() || origScale != getSNScale()) { + if (origPosition != getWorldPosition() || origRotation != getRotation() || origDimensions != getDimensions() || origScale != getSNScale()) { _updateModel = true; } @@ -384,7 +384,7 @@ void ModelOverlay::locationChanged(bool tellPhysics) { // FIXME Start using the _renderTransform instead of calling for Transform and Dimensions from here, do the custom things needed in evalRenderTransform() if (_model && _model->isActive()) { _model->setRotation(getRotation()); - _model->setTranslation(getPosition()); + _model->setTranslation(getWorldPosition()); } } diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index fd5aae4027..ca79d0b663 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -827,7 +827,7 @@ PointerEvent Overlays::calculateOverlayPointerEvent(OverlayID overlayID, PickRay if (!overlay) { return PointerEvent(); } - glm::vec3 position = overlay->getPosition(); + glm::vec3 position = overlay->getWorldPosition(); glm::quat rotation = overlay->getRotation(); glm::vec2 dimensions = overlay->getSize(); diff --git a/interface/src/ui/overlays/OverlaysPayload.cpp b/interface/src/ui/overlays/OverlaysPayload.cpp index 194c530df0..40d70d5348 100644 --- a/interface/src/ui/overlays/OverlaysPayload.cpp +++ b/interface/src/ui/overlays/OverlaysPayload.cpp @@ -69,7 +69,7 @@ namespace render { auto batch = args->_batch; auto avatar = DependencyManager::get()->getMyAvatar(); glm::quat myAvatarRotation = avatar->getOrientation(); - glm::vec3 myAvatarPosition = avatar->getPosition(); + glm::vec3 myAvatarPosition = avatar->getWorldPosition(); float angle = glm::degrees(glm::angle(myAvatarRotation)); glm::vec3 axis = glm::axis(myAvatarRotation); float myAvatarScale = avatar->getModelScale(); diff --git a/interface/src/ui/overlays/Planar3DOverlay.cpp b/interface/src/ui/overlays/Planar3DOverlay.cpp index ac3fe66ddc..ae5e0f32d0 100644 --- a/interface/src/ui/overlays/Planar3DOverlay.cpp +++ b/interface/src/ui/overlays/Planar3DOverlay.cpp @@ -69,7 +69,7 @@ QVariant Planar3DOverlay::getProperty(const QString& property) { bool Planar3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, BoxFace& face, glm::vec3& surfaceNormal) { // FIXME - face and surfaceNormal not being returned - return findRayRectangleIntersection(origin, direction, getRotation(), getPosition(), getDimensions(), distance); + return findRayRectangleIntersection(origin, direction, getRotation(), getWorldPosition(), getDimensions(), distance); } Transform Planar3DOverlay::evalRenderTransform() { diff --git a/interface/src/ui/overlays/Rectangle3DOverlay.cpp b/interface/src/ui/overlays/Rectangle3DOverlay.cpp index 47d47b76a5..2010b00d4d 100644 --- a/interface/src/ui/overlays/Rectangle3DOverlay.cpp +++ b/interface/src/ui/overlays/Rectangle3DOverlay.cpp @@ -58,7 +58,7 @@ void Rectangle3DOverlay::render(RenderArgs* args) { const float MAX_COLOR = 255.0f; glm::vec4 rectangleColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha); - glm::vec3 position = getPosition(); + glm::vec3 position = getWorldPosition(); glm::vec2 dimensions = getDimensions(); glm::vec2 halfDimensions = dimensions * 0.5f; glm::quat rotation = getRotation(); diff --git a/interface/src/ui/overlays/Shape3DOverlay.cpp b/interface/src/ui/overlays/Shape3DOverlay.cpp index a3b51d40bf..7e9f44ef1d 100644 --- a/interface/src/ui/overlays/Shape3DOverlay.cpp +++ b/interface/src/ui/overlays/Shape3DOverlay.cpp @@ -121,7 +121,7 @@ QVariant Shape3DOverlay::getProperty(const QString& property) { Transform Shape3DOverlay::evalRenderTransform() { // TODO: handle registration point?? - glm::vec3 position = getPosition(); + glm::vec3 position = getWorldPosition(); glm::vec3 dimensions = getDimensions(); glm::quat rotation = getRotation(); diff --git a/interface/src/ui/overlays/Volume3DOverlay.cpp b/interface/src/ui/overlays/Volume3DOverlay.cpp index 8aa8490937..4e685bed0e 100644 --- a/interface/src/ui/overlays/Volume3DOverlay.cpp +++ b/interface/src/ui/overlays/Volume3DOverlay.cpp @@ -21,7 +21,7 @@ Volume3DOverlay::Volume3DOverlay(const Volume3DOverlay* volume3DOverlay) : AABox Volume3DOverlay::getBounds() const { auto extents = Extents{_localBoundingBox}; extents.rotate(getRotation()); - extents.shiftBy(getPosition()); + extents.shiftBy(getWorldPosition()); return AABox(extents); } diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 0c75803d35..5d8e433615 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -151,7 +151,7 @@ void Web3DOverlay::buildWebSurface() { _webSurface = DependencyManager::get()->acquire(_url); setupQmlSurface(); } - _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition())); + _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getWorldPosition())); _webSurface->resize(QSize(_resolution.x, _resolution.y)); _webSurface->resume(); }); @@ -171,7 +171,7 @@ void Web3DOverlay::hoverLeaveOverlay(const PointerEvent& event) { void Web3DOverlay::update(float deltatime) { if (_webSurface) { // update globalPosition - _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition())); + _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getWorldPosition())); } Parent::update(deltatime); } @@ -615,7 +615,7 @@ bool Web3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::vec3& // Don't call applyTransformTo() or setTransform() here because this code runs too frequently. // Produce the dimensions of the overlay based on the image's aspect ratio and the overlay's scale. - return findRayRectangleIntersection(origin, direction, getRotation(), getPosition(), getSize(), distance); + return findRayRectangleIntersection(origin, direction, getRotation(), getWorldPosition(), getSize(), distance); } Web3DOverlay* Web3DOverlay::createClone() const { diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index f674a2206e..67efeda90d 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -145,18 +145,18 @@ void Avatar::init() { glm::vec3 Avatar::getChestPosition() const { // for now, let's just assume that the "chest" is halfway between the root and the neck glm::vec3 neckPosition; - return _skeletonModel->getNeckPosition(neckPosition) ? (getPosition() + neckPosition) * 0.5f : getPosition(); + return _skeletonModel->getNeckPosition(neckPosition) ? (getWorldPosition() + neckPosition) * 0.5f : getWorldPosition(); } glm::vec3 Avatar::getNeckPosition() const { glm::vec3 neckPosition; - return _skeletonModel->getNeckPosition(neckPosition) ? neckPosition : getPosition(); + return _skeletonModel->getNeckPosition(neckPosition) ? neckPosition : getWorldPosition(); } AABox Avatar::getBounds() const { if (!_skeletonModel->isRenderable() || _skeletonModel->needsFixupInScene()) { // approximately 2m tall, scaled to user request. - return AABox(getPosition() - glm::vec3(getModelScale()), getModelScale() * 2.0f); + return AABox(getWorldPosition() - glm::vec3(getModelScale()), getModelScale() * 2.0f); } return _skeletonModel->getRenderableMeshBound(); } @@ -359,9 +359,9 @@ void Avatar::simulate(float deltaTime, bool inView) { locationChanged(); // joints changed, so if there are any children, update them. _hasNewJointData = false; - glm::vec3 headPosition = getPosition(); + glm::vec3 headPosition = getWorldPosition(); if (!_skeletonModel->getHeadPosition(headPosition)) { - headPosition = getPosition(); + headPosition = getWorldPosition(); } head->setPosition(headPosition); } @@ -427,7 +427,7 @@ bool Avatar::isLookingAtMe(AvatarSharedPointer avatar) const { } void Avatar::slamPosition(const glm::vec3& newPosition) { - setPosition(newPosition); + setWorldPosition(newPosition); _positionDeltaAccumulator = glm::vec3(0.0f); setVelocity(glm::vec3(0.0f)); _lastVelocity = glm::vec3(0.0f); @@ -439,7 +439,7 @@ void Avatar::updateAttitude(const glm::quat& orientation) { } void Avatar::applyPositionDelta(const glm::vec3& delta) { - setPosition(getPosition() + delta); + setWorldPosition(getWorldPosition() + delta); _positionDeltaAccumulator += delta; } @@ -588,7 +588,7 @@ void Avatar::render(RenderArgs* renderArgs) { glm::vec3 viewPos = renderArgs->getViewFrustum().getPosition(); const float MAX_DISTANCE_SQUARED_FOR_SHOWING_POINTING_LASERS = 100.0f; // 10^2 - if (glm::distance2(viewPos, getPosition()) < MAX_DISTANCE_SQUARED_FOR_SHOWING_POINTING_LASERS) { + if (glm::distance2(viewPos, getWorldPosition()) < MAX_DISTANCE_SQUARED_FOR_SHOWING_POINTING_LASERS) { auto geometryCache = DependencyManager::get(); // render pointing lasers @@ -647,7 +647,7 @@ void Avatar::render(RenderArgs* renderArgs) { } ViewFrustum frustum = renderArgs->getViewFrustum(); - if (!frustum.sphereIntersectsFrustum(getPosition(), getBoundingRadius())) { + if (!frustum.sphereIntersectsFrustum(getWorldPosition(), getBoundingRadius())) { return; } @@ -658,7 +658,7 @@ void Avatar::render(RenderArgs* renderArgs) { } if (showReceiveStats || showNamesAboveHeads) { - glm::vec3 toTarget = frustum.getPosition() - getPosition(); + glm::vec3 toTarget = frustum.getPosition() - getWorldPosition(); float distanceToTarget = glm::length(toTarget); const float DISPLAYNAME_DISTANCE = 20.0f; updateDisplayNameAlpha(distanceToTarget < DISPLAYNAME_DISTANCE); @@ -721,7 +721,7 @@ void Avatar::simulateAttachments(float deltaTime) { glm::quat jointRotation; if (attachment.isSoft) { // soft attachments do not have transform offsets - model->setTranslation(getPosition()); + model->setTranslation(getWorldPosition()); model->setRotation(getOrientation() * Quaternions::Y_180); model->simulate(deltaTime); } else { @@ -775,9 +775,9 @@ glm::vec3 Avatar::getDisplayNamePosition() const { const float HEAD_PROPORTION = 0.75f; float size = getBoundingRadius(); - DEBUG_VALUE("_position =", getPosition()); + DEBUG_VALUE("_position =", getWorldPosition()); DEBUG_VALUE("size =", size); - namePosition = getPosition() + bodyUpDirection * (size * HEAD_PROPORTION); + namePosition = getWorldPosition() + bodyUpDirection * (size * HEAD_PROPORTION); } if (glm::any(glm::isnan(namePosition)) || glm::any(glm::isinf(namePosition))) { @@ -902,7 +902,7 @@ glm::vec3 Avatar::getSkeletonPosition() const { // The avatar is rotated PI about the yAxis, so we have to correct for it // to get the skeleton offset contribution in the world-frame. const glm::quat FLIP = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f)); - return getPosition() + getOrientation() * FLIP * _skeletonOffset; + return getWorldPosition() + getOrientation() * FLIP * _skeletonOffset; } QVector Avatar::getJointRotations() const { @@ -1166,7 +1166,7 @@ glm::vec3 Avatar::getJointPosition(const QString& name) const { void Avatar::scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const { //Scale a world space vector as if it was relative to the position - positionToScale = getPosition() + getModelScale() * (positionToScale - getPosition()); + positionToScale = getWorldPosition() + getModelScale() * (positionToScale - getWorldPosition()); } void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) { @@ -1254,12 +1254,12 @@ int Avatar::parseDataFromBuffer(const QByteArray& buffer) { } // change in position implies movement - glm::vec3 oldPosition = getPosition(); + glm::vec3 oldPosition = getWorldPosition(); int bytesRead = AvatarData::parseDataFromBuffer(buffer); const float MOVE_DISTANCE_THRESHOLD = 0.001f; - _moving = glm::distance(oldPosition, getPosition()) > MOVE_DISTANCE_THRESHOLD; + _moving = glm::distance(oldPosition, getWorldPosition()) > MOVE_DISTANCE_THRESHOLD; if (_moving) { addPhysicsFlags(Simulation::DIRTY_POSITION); } @@ -1333,7 +1333,7 @@ float Avatar::getHeadHeight() const { Extents extents = _skeletonModel->getMeshExtents(); glm::vec3 neckPosition; if (!extents.isEmpty() && extents.isValid() && _skeletonModel->getNeckPosition(neckPosition)) { - return extents.maximum.y / 2.0f - neckPosition.y + getPosition().y; + return extents.maximum.y / 2.0f - neckPosition.y + getWorldPosition().y; } const float DEFAULT_HEAD_HEIGHT = 0.25f; @@ -1378,8 +1378,8 @@ void Avatar::getCapsule(glm::vec3& start, glm::vec3& end, float& radius) { ShapeInfo shapeInfo; computeShapeInfo(shapeInfo); glm::vec3 halfExtents = shapeInfo.getHalfExtents(); // x = radius, y = halfHeight - start = getPosition() - glm::vec3(0, halfExtents.y, 0) + shapeInfo.getOffset(); - end = getPosition() + glm::vec3(0, halfExtents.y, 0) + shapeInfo.getOffset(); + start = getWorldPosition() - glm::vec3(0, halfExtents.y, 0) + shapeInfo.getOffset(); + end = getWorldPosition() + glm::vec3(0, halfExtents.y, 0) + shapeInfo.getOffset(); radius = halfExtents.x; } @@ -1472,7 +1472,7 @@ glm::quat Avatar::getUncachedRightPalmRotation() const { } void Avatar::setPositionViaScript(const glm::vec3& position) { - setPosition(position); + setWorldPosition(position); updateAttitude(getOrientation()); } diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 877bcd9353..2fe62a4ca2 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -118,12 +118,12 @@ void AvatarData::setTargetScale(float targetScale) { } glm::vec3 AvatarData::getHandPosition() const { - return getOrientation() * _handPosition + getPosition(); + return getOrientation() * _handPosition + getWorldPosition(); } void AvatarData::setHandPosition(const glm::vec3& handPosition) { // store relative to position/orientation - _handPosition = glm::inverse(getOrientation()) * (handPosition - getPosition()); + _handPosition = glm::inverse(getOrientation()) * (handPosition - getWorldPosition()); } void AvatarData::lazyInitHeadData() const { @@ -1901,7 +1901,7 @@ void AvatarData::setRecordingBasis(std::shared_ptr recordingBasis) { if (!recordingBasis) { recordingBasis = std::make_shared(); recordingBasis->setRotation(getOrientation()); - recordingBasis->setTranslation(getPosition()); + recordingBasis->setTranslation(getWorldPosition()); // TODO: find a different way to record/playback the Scale of the avatar //recordingBasis->setScale(getTargetScale()); } @@ -2059,11 +2059,11 @@ void AvatarData::fromJson(const QJsonObject& json, bool useFrameSkeleton) { auto relativeTransform = Transform::fromJson(json[JSON_AVATAR_RELATIVE]); auto worldTransform = currentBasis->worldTransform(relativeTransform); - setPosition(worldTransform.getTranslation()); + setWorldPosition(worldTransform.getTranslation()); orientation = worldTransform.getRotation(); } else { // We still set the position in the case that there is no movement. - setPosition(currentBasis->getTranslation()); + setWorldPosition(currentBasis->getTranslation()); orientation = currentBasis->getRotation(); } setOrientation(orientation); @@ -2186,7 +2186,7 @@ void AvatarData::setBodyRoll(float bodyRoll) { } void AvatarData::setPositionViaScript(const glm::vec3& position) { - SpatiallyNestable::setPosition(position); + SpatiallyNestable::setWorldPosition(position); } void AvatarData::setOrientationViaScript(const glm::quat& orientation) { @@ -2413,7 +2413,7 @@ void AvatarData::sortAvatars( // (a) apparentSize // (b) proximity to center of view // (c) time since last update - glm::vec3 avatarPosition = avatar->getPosition(); + glm::vec3 avatarPosition = avatar->getWorldPosition(); glm::vec3 offset = avatarPosition - frustumCenter; float distance = glm::length(offset) + 0.001f; // add 1mm to avoid divide by zero diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 89fe270af1..5ce4395baa 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -351,7 +351,7 @@ public: class AvatarData : public QObject, public SpatiallyNestable { Q_OBJECT - Q_PROPERTY(glm::vec3 position READ getPosition WRITE setPositionViaScript) + Q_PROPERTY(glm::vec3 position READ getWorldPosition WRITE setPositionViaScript) Q_PROPERTY(float scale READ getTargetScale WRITE setTargetScale) Q_PROPERTY(float density READ getDensity) Q_PROPERTY(glm::vec3 handPosition READ getHandPosition WRITE setHandPosition) diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index 3712080cdb..61b13d7749 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -33,7 +33,7 @@ QVector AvatarHashMap::getAvatarIdentifiers() { bool AvatarHashMap::isAvatarInRange(const glm::vec3& position, const float range) { auto hashCopy = getHashCopy(); foreach(const AvatarSharedPointer& sharedAvatar, hashCopy) { - glm::vec3 avatarPosition = sharedAvatar->getPosition(); + glm::vec3 avatarPosition = sharedAvatar->getWorldPosition(); float distance = glm::distance(avatarPosition, position); if (distance < range) { return true; @@ -47,7 +47,7 @@ int AvatarHashMap::numberOfAvatarsInRange(const glm::vec3& position, float range auto rangeMeters2 = rangeMeters * rangeMeters; int count = 0; for (const AvatarSharedPointer& sharedAvatar : hashCopy) { - glm::vec3 avatarPosition = sharedAvatar->getPosition(); + glm::vec3 avatarPosition = sharedAvatar->getWorldPosition(); auto distance2 = glm::distance2(avatarPosition, position); if (distance2 < rangeMeters2) { ++count; diff --git a/libraries/avatars/src/HeadData.cpp b/libraries/avatars/src/HeadData.cpp index 1fda984e78..6ff36331cf 100644 --- a/libraries/avatars/src/HeadData.cpp +++ b/libraries/avatars/src/HeadData.cpp @@ -155,7 +155,7 @@ QJsonObject HeadData::toJson() const { auto lookat = getLookAtPosition(); if (lookat != vec3()) { vec3 relativeLookAt = glm::inverse(_owningAvatar->getOrientation()) * - (getLookAtPosition() - _owningAvatar->getPosition()); + (getLookAtPosition() - _owningAvatar->getWorldPosition()); headJson[JSON_AVATAR_HEAD_LOOKAT] = toJsonValue(relativeLookAt); } return headJson; @@ -185,7 +185,7 @@ void HeadData::fromJson(const QJsonObject& json) { if (json.contains(JSON_AVATAR_HEAD_LOOKAT)) { auto relativeLookAt = vec3FromJsonValue(json[JSON_AVATAR_HEAD_LOOKAT]); if (glm::length2(relativeLookAt) > 0.01f) { - setLookAtPosition((_owningAvatar->getOrientation() * relativeLookAt) + _owningAvatar->getPosition()); + setLookAtPosition((_owningAvatar->getOrientation() * relativeLookAt) + _owningAvatar->getWorldPosition()); } } diff --git a/libraries/avatars/src/ScriptAvatarData.cpp b/libraries/avatars/src/ScriptAvatarData.cpp index d0643d28f8..cac3f600ca 100644 --- a/libraries/avatars/src/ScriptAvatarData.cpp +++ b/libraries/avatars/src/ScriptAvatarData.cpp @@ -24,7 +24,7 @@ ScriptAvatarData::ScriptAvatarData(AvatarSharedPointer avatarData) : // glm::vec3 ScriptAvatarData::getPosition() const { if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) { - return sharedAvatarData->getPosition(); + return sharedAvatarData->getWorldPosition(); } else { return glm::vec3(); } diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index bf17f34749..a9277ff19a 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -509,7 +509,7 @@ static glm::vec2 projectOntoEntityXYPlane(EntityItemPointer entity, const PickRa if (entity) { - glm::vec3 entityPosition = entity->getPosition(); + glm::vec3 entityPosition = entity->getWorldPosition(); glm::quat entityRotation = entity->getRotation(); glm::vec3 entityDimensions = entity->getDimensions(); glm::vec3 entityRegistrationPoint = entity->getRegistrationPoint(); diff --git a/libraries/entities-renderer/src/RenderableLightEntityItem.cpp b/libraries/entities-renderer/src/RenderableLightEntityItem.cpp index 738b1a253e..e00cd98e65 100644 --- a/libraries/entities-renderer/src/RenderableLightEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableLightEntityItem.cpp @@ -28,7 +28,7 @@ void LightEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPoint lightPayload.setVisible(_visible); auto light = lightPayload.editLight(); - light->setPosition(entity->getPosition()); + light->setPosition(entity->getWorldPosition()); light->setOrientation(entity->getRotation()); bool success; diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 7db19704b4..67b7b175b7 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -124,7 +124,7 @@ void RenderableModelEntityItem::doInitialModelSimulation() { model->setScaleToFit(true, getDimensions()); model->setSnapModelToRegistrationPoint(true, getRegistrationPoint()); model->setRotation(getRotation()); - model->setTranslation(getPosition()); + model->setTranslation(getWorldPosition()); if (_needsInitialSimulation) { model->simulate(0.0f); diff --git a/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp index 3fd1d024c1..e4706fa15e 100644 --- a/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyLineEntityItem.cpp @@ -154,7 +154,7 @@ void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo entity->resetPolyLineChanged(); _polylineTransform = Transform(); - _polylineTransform.setTranslation(entity->getPosition()); + _polylineTransform.setTranslation(entity->getWorldPosition()); _polylineTransform.setRotation(entity->getRotation()); if (pointsChanged) { diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp index e92bc636bd..fd7407287d 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp @@ -232,7 +232,7 @@ glm::mat4 RenderablePolyVoxEntityItem::voxelToLocalMatrix() const { glm::vec3 scale = dimensions / voxelVolumeSize; // meters / voxel-units bool success; // TODO -- Does this actually have to happen in world space? glm::vec3 center = getCenterPosition(success); // this handles registrationPoint changes - glm::vec3 position = getPosition(success); + glm::vec3 position = getWorldPosition(success); glm::vec3 positionToCenter = center - position; positionToCenter -= dimensions * Vectors::HALF - getSurfacePositionAdjustment(); @@ -248,7 +248,7 @@ glm::mat4 RenderablePolyVoxEntityItem::localToVoxelMatrix() const { glm::mat4 RenderablePolyVoxEntityItem::voxelToWorldMatrix() const { glm::mat4 rotation = glm::mat4_cast(getRotation()); - glm::mat4 translation = glm::translate(getPosition()); + glm::mat4 translation = glm::translate(getWorldPosition()); return translation * rotation * voxelToLocalMatrix(); } @@ -579,7 +579,7 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o // the PolyVox ray intersection code requires a near and far point. // set ray cast length to long enough to cover all of the voxel space - float distanceToEntity = glm::distance(origin, getPosition()); + float distanceToEntity = glm::distance(origin, getWorldPosition()); glm::vec3 dimensions = getDimensions(); float largestDimension = glm::compMax(dimensions) * 2.0f; glm::vec3 farPoint = origin + normDirection * (distanceToEntity + largestDimension); diff --git a/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp b/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp index 332d87f930..dffde3386b 100644 --- a/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableShapeEntityItem.cpp @@ -81,7 +81,7 @@ void ShapeEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce _color = vec4(toGlm(entity->getXColor()), entity->getLocalRenderAlpha()); _shape = entity->getShape(); - _position = entity->getPosition(); + _position = entity->getWorldPosition(); _dimensions = entity->getDimensions(); _orientation = entity->getOrientation(); _renderTransform = getModelTransform(); diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp index a2e574a829..231f9c35b6 100644 --- a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp @@ -69,7 +69,7 @@ void WebEntityRenderer::onRemoveFromSceneTyped(const TypedEntityPointer& entity) } bool WebEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const { - if (_contextPosition != entity->getPosition()) { + if (_contextPosition != entity->getWorldPosition()) { return true; } @@ -127,9 +127,9 @@ void WebEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scene buildWebSurface(entity); } - if (_contextPosition != entity->getPosition()) { + if (_contextPosition != entity->getWorldPosition()) { // update globalPosition - _contextPosition = entity->getPosition(); + _contextPosition = entity->getWorldPosition(); _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(_contextPosition)); } diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp index 0235f1b7a3..e56e692890 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.cpp @@ -200,7 +200,7 @@ void ZoneEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& scen bool hazeChanged = entity->hazePropertiesChanged(); entity->resetRenderingPropertiesChanged(); - _lastPosition = entity->getPosition(); + _lastPosition = entity->getWorldPosition(); _lastRotation = entity->getRotation(); _lastDimensions = entity->getDimensions(); @@ -271,7 +271,7 @@ bool ZoneEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPoint return true; } - if (entity->getPosition() != _lastPosition) { + if (entity->getWorldPosition() != _lastPosition) { return true; } if (entity->getDimensions() != _lastDimensions) { diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 71e6990aaf..e1ff932915 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -888,7 +888,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef } void EntityItem::debugDump() const { - auto position = getPosition(); + auto position = getWorldPosition(); qCDebug(entities) << "EntityItem id:" << getEntityItemID(); qCDebug(entities, " edited ago:%f", (double)getEditedAgo()); qCDebug(entities, " position:%f,%f,%f", (double)position.x, (double)position.y, (double)position.z); @@ -1168,7 +1168,7 @@ bool EntityItem::wantTerseEditLogging() const { } glm::mat4 EntityItem::getEntityToWorldMatrix() const { - glm::mat4 translation = glm::translate(getPosition()); + glm::mat4 translation = glm::translate(getWorldPosition()); glm::mat4 rotation = glm::mat4_cast(getRotation()); glm::mat4 scale = glm::scale(getDimensions()); glm::mat4 registration = glm::translate(ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint()); @@ -1429,7 +1429,7 @@ const Transform EntityItem::getTransformToCenter(bool& success) const { /// AACube EntityItem::getMaximumAACube(bool& success) const { if (_recalcMaxAACube) { - glm::vec3 centerOfRotation = getPosition(success); // also where _registration point is + glm::vec3 centerOfRotation = getWorldPosition(success); // also where _registration point is if (success) { _recalcMaxAACube = false; // we want to compute the furthestExtent that an entity can extend out from its "position" @@ -1457,7 +1457,7 @@ AACube EntityItem::getMaximumAACube(bool& success) const { AACube EntityItem::getMinimumAACube(bool& success) const { if (_recalcMinAACube) { // position represents the position of the registration point. - glm::vec3 position = getPosition(success); + glm::vec3 position = getWorldPosition(success); if (success) { _recalcMinAACube = false; glm::vec3 dimensions = getDimensions(); @@ -1487,7 +1487,7 @@ AACube EntityItem::getMinimumAACube(bool& success) const { AABox EntityItem::getAABox(bool& success) const { if (_recalcAABox) { // position represents the position of the registration point. - glm::vec3 position = getPosition(success); + glm::vec3 position = getWorldPosition(success); if (success) { _recalcAABox = false; glm::vec3 dimensions = getDimensions(); @@ -2381,7 +2381,7 @@ void EntityItem::dimensionsChanged() { void EntityItem::globalizeProperties(EntityItemProperties& properties, const QString& messageTemplate, const glm::vec3& offset) const { // TODO -- combine this with convertLocationToScriptSemantics bool success; - auto globalPosition = getPosition(success); + auto globalPosition = getWorldPosition(success); if (success) { properties.setPosition(globalPosition + offset); properties.setRotation(getRotation()); diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index ed7a1469b3..329a616609 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -385,7 +385,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& properties.setParentJointIndex(entity->getParentJointIndex()); } if (!scriptSideProperties.localPositionChanged() && !scriptSideProperties.positionChanged()) { - properties.setPosition(entity->getPosition()); + properties.setPosition(entity->getWorldPosition()); } if (!scriptSideProperties.localRotationChanged() && !scriptSideProperties.rotationChanged()) { properties.setRotation(entity->getOrientation()); @@ -1797,7 +1797,7 @@ glm::mat4 EntityScriptingInterface::getEntityTransform(const QUuid& entityID) { _entityTree->withReadLock([&] { EntityItemPointer entity = _entityTree->findEntityByEntityItemID(EntityItemID(entityID)); if (entity) { - glm::mat4 translation = glm::translate(entity->getPosition()); + glm::mat4 translation = glm::translate(entity->getWorldPosition()); glm::mat4 rotation = glm::mat4_cast(entity->getRotation()); result = translation * rotation; } diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index bde82d96a1..64fbc6aefb 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -681,7 +681,7 @@ bool EntityTree::findNearPointOperation(const OctreeElementPointer& element, voi // we may have gotten NULL back, meaning no entity was available if (thisClosestEntity) { - glm::vec3 entityPosition = thisClosestEntity->getPosition(); + glm::vec3 entityPosition = thisClosestEntity->getWorldPosition(); float distanceFromPointToEntity = glm::distance(entityPosition, args->position); // If we're within our target radius @@ -1054,7 +1054,7 @@ bool EntityTree::filterProperties(EntityItemPointer& existingEntity, EntityItemP bool accepted = true; auto entityEditFilters = DependencyManager::get(); if (entityEditFilters) { - auto position = existingEntity ? existingEntity->getPosition() : propertiesIn.getPosition(); + auto position = existingEntity ? existingEntity->getWorldPosition() : propertiesIn.getPosition(); auto entityID = existingEntity ? existingEntity->getEntityItemID() : EntityItemID(); accepted = entityEditFilters->filter(position, propertiesIn, propertiesOut, wasChanged, filterType, entityID); } diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 2696377028..4b588fc23c 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -663,7 +663,7 @@ bool EntityTreeElement::findDetailedRayIntersection(const glm::vec3& origin, con // extents is the entity relative, scaled, centered extents of the entity glm::mat4 rotation = glm::mat4_cast(entity->getRotation()); - glm::mat4 translation = glm::translate(entity->getPosition()); + glm::mat4 translation = glm::translate(entity->getWorldPosition()); glm::mat4 entityToWorldMatrix = translation * rotation; glm::mat4 worldToEntityMatrix = glm::inverse(entityToWorldMatrix); @@ -718,7 +718,7 @@ bool EntityTreeElement::findSpherePenetration(const glm::vec3& center, float rad bool result = false; withReadLock([&] { foreach(EntityItemPointer entity, _entityItems) { - glm::vec3 entityCenter = entity->getPosition(); + glm::vec3 entityCenter = entity->getWorldPosition(); float entityRadius = entity->getRadius(); // don't penetrate yourself @@ -743,7 +743,7 @@ EntityItemPointer EntityTreeElement::getClosestEntity(glm::vec3 position) const float closestEntityDistance = FLT_MAX; withReadLock([&] { foreach(EntityItemPointer entity, _entityItems) { - float distanceToEntity = glm::distance2(position, entity->getPosition()); + float distanceToEntity = glm::distance2(position, entity->getWorldPosition()); if (distanceToEntity < closestEntityDistance) { closestEntity = entity; } @@ -788,7 +788,7 @@ void EntityTreeElement::getEntities(const glm::vec3& searchPosition, float searc // determine the worldToEntityMatrix that doesn't include scale because // we're going to use the registration aware aa box in the entity frame glm::mat4 rotation = glm::mat4_cast(entity->getRotation()); - glm::mat4 translation = glm::translate(entity->getPosition()); + glm::mat4 translation = glm::translate(entity->getWorldPosition()); glm::mat4 entityToWorldMatrix = translation * rotation; glm::mat4 worldToEntityMatrix = glm::inverse(entityToWorldMatrix); diff --git a/libraries/entities/src/LineEntityItem.cpp b/libraries/entities/src/LineEntityItem.cpp index 119236e32d..02d16f2537 100644 --- a/libraries/entities/src/LineEntityItem.cpp +++ b/libraries/entities/src/LineEntityItem.cpp @@ -156,7 +156,7 @@ void LineEntityItem::debugDump() const { quint64 now = usecTimestampNow(); qCDebug(entities) << " LINE EntityItem id:" << getEntityItemID() << "---------------------------------------------"; qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; - qCDebug(entities) << " position:" << debugTreeVector(getPosition()); + qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition()); qCDebug(entities) << " dimensions:" << debugTreeVector(getDimensions()); qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); } diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 26f063f7cc..313721ff54 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -189,7 +189,7 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit void ModelEntityItem::debugDump() const { qCDebug(entities) << "ModelEntityItem id:" << getEntityItemID(); qCDebug(entities) << " edited ago:" << getEditedAgo(); - qCDebug(entities) << " position:" << getPosition(); + qCDebug(entities) << " position:" << getWorldPosition(); qCDebug(entities) << " dimensions:" << getDimensions(); qCDebug(entities) << " model URL:" << getModelURL(); qCDebug(entities) << " compound shape URL:" << getCompoundShapeURL(); diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp index b216144ded..05c0feca18 100644 --- a/libraries/entities/src/ParticleEffectEntityItem.cpp +++ b/libraries/entities/src/ParticleEffectEntityItem.cpp @@ -591,7 +591,7 @@ void ParticleEffectEntityItem::debugDump() const { _particleProperties.color.gradient.target.red << "," << _particleProperties.color.gradient.target.green << "," << _particleProperties.color.gradient.target.blue; - qCDebug(entities) << " position:" << debugTreeVector(getPosition()); + qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition()); qCDebug(entities) << " dimensions:" << debugTreeVector(getDimensions()); qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); } diff --git a/libraries/entities/src/PolyLineEntityItem.cpp b/libraries/entities/src/PolyLineEntityItem.cpp index 7cd70fdb21..e69fb2e100 100644 --- a/libraries/entities/src/PolyLineEntityItem.cpp +++ b/libraries/entities/src/PolyLineEntityItem.cpp @@ -256,7 +256,7 @@ void PolyLineEntityItem::debugDump() const { quint64 now = usecTimestampNow(); qCDebug(entities) << " QUAD EntityItem id:" << getEntityItemID() << "---------------------------------------------"; qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; - qCDebug(entities) << " position:" << debugTreeVector(getPosition()); + qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition()); qCDebug(entities) << " dimensions:" << debugTreeVector(getDimensions()); qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); } diff --git a/libraries/entities/src/PolyVoxEntityItem.cpp b/libraries/entities/src/PolyVoxEntityItem.cpp index e577a6c1a7..abcc075bcf 100644 --- a/libraries/entities/src/PolyVoxEntityItem.cpp +++ b/libraries/entities/src/PolyVoxEntityItem.cpp @@ -228,7 +228,7 @@ void PolyVoxEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeB void PolyVoxEntityItem::debugDump() const { quint64 now = usecTimestampNow(); qCDebug(entities) << " POLYVOX EntityItem id:" << getEntityItemID() << "---------------------------------------------"; - qCDebug(entities) << " position:" << debugTreeVector(getPosition()); + qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition()); qCDebug(entities) << " dimensions:" << debugTreeVector(getDimensions()); qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); } @@ -396,7 +396,7 @@ glm::mat4 PolyVoxEntityItem::voxelToLocalMatrix() const { glm::vec3 scale = dimensions / voxelVolumeSize; // meters / voxel-units bool success; // TODO -- Does this actually have to happen in world space? glm::vec3 center = getCenterPosition(success); // this handles registrationPoint changes - glm::vec3 position = getPosition(success); + glm::vec3 position = getWorldPosition(success); glm::vec3 positionToCenter = center - position; positionToCenter -= dimensions * Vectors::HALF - getSurfacePositionAdjustment(); @@ -412,7 +412,7 @@ glm::mat4 PolyVoxEntityItem::localToVoxelMatrix() const { glm::mat4 PolyVoxEntityItem::voxelToWorldMatrix() const { glm::mat4 rotation = glm::mat4_cast(getRotation()); - glm::mat4 translation = glm::translate(getPosition()); + glm::mat4 translation = glm::translate(getWorldPosition()); return translation * rotation * voxelToLocalMatrix(); } diff --git a/libraries/entities/src/ShapeEntityItem.cpp b/libraries/entities/src/ShapeEntityItem.cpp index 9a1a500a54..654fecb156 100644 --- a/libraries/entities/src/ShapeEntityItem.cpp +++ b/libraries/entities/src/ShapeEntityItem.cpp @@ -235,7 +235,7 @@ void ShapeEntityItem::debugDump() const { qCDebug(entities) << " shape:" << stringFromShape(_shape) << " (EnumId: " << _shape << " )"; qCDebug(entities) << " collisionShapeType:" << ShapeInfo::getNameForShapeType(getShapeType()); qCDebug(entities) << " color:" << _color[0] << "," << _color[1] << "," << _color[2]; - qCDebug(entities) << " position:" << debugTreeVector(getPosition()); + qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition()); qCDebug(entities) << " dimensions:" << debugTreeVector(getDimensions()); qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); qCDebug(entities) << "SHAPE EntityItem Ptr:" << this; diff --git a/libraries/entities/src/TextEntityItem.cpp b/libraries/entities/src/TextEntityItem.cpp index 074691e1d4..0f113248f7 100644 --- a/libraries/entities/src/TextEntityItem.cpp +++ b/libraries/entities/src/TextEntityItem.cpp @@ -135,7 +135,7 @@ bool TextEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3 dimensions = getDimensions(); glm::vec2 xyDimensions(dimensions.x, dimensions.y); glm::quat rotation = getRotation(); - glm::vec3 position = getPosition() + rotation * + glm::vec3 position = getWorldPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); // FIXME - should set face and surfaceNormal diff --git a/libraries/entities/src/WebEntityItem.cpp b/libraries/entities/src/WebEntityItem.cpp index dd4bf518e0..91137431fe 100644 --- a/libraries/entities/src/WebEntityItem.cpp +++ b/libraries/entities/src/WebEntityItem.cpp @@ -112,7 +112,7 @@ bool WebEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const g glm::vec3 dimensions = getDimensions(); glm::vec2 xyDimensions(dimensions.x, dimensions.y); glm::quat rotation = getRotation(); - glm::vec3 position = getPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); + glm::vec3 position = getWorldPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); if (findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance)) { surfaceNormal = rotation * Vectors::UNIT_Z; diff --git a/libraries/entities/src/ZoneEntityItem.cpp b/libraries/entities/src/ZoneEntityItem.cpp index 588c1f9386..debe3eab61 100644 --- a/libraries/entities/src/ZoneEntityItem.cpp +++ b/libraries/entities/src/ZoneEntityItem.cpp @@ -241,7 +241,7 @@ void ZoneEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits void ZoneEntityItem::debugDump() const { quint64 now = usecTimestampNow(); qCDebug(entities) << " ZoneEntityItem id:" << getEntityItemID() << "---------------------------------------------"; - qCDebug(entities) << " position:" << debugTreeVector(getPosition()); + qCDebug(entities) << " position:" << debugTreeVector(getWorldPosition()); qCDebug(entities) << " dimensions:" << debugTreeVector(getDimensions()); qCDebug(entities) << " getLastEdited:" << debugTime(getLastEdited(), now); qCDebug(entities) << " _backgroundMode:" << EntityItemProperties::getBackgroundModeString(_backgroundMode); diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 6884482074..be56bffb18 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -108,7 +108,7 @@ void EntityMotionState::handleDeactivation() { _entity->setLocalTransformAndVelocities(localTransform, ENTITY_ITEM_ZERO_VEC3, ENTITY_ITEM_ZERO_VEC3); // and also to RigidBody btTransform worldTrans; - worldTrans.setOrigin(glmToBullet(_entity->getPosition())); + worldTrans.setOrigin(glmToBullet(_entity->getWorldPosition())); worldTrans.setRotation(glmToBullet(_entity->getRotation())); _body->setWorldTransform(worldTrans); // no need to update velocities... should already be zero @@ -256,7 +256,7 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) { assert(entityTreeIsLocked()); measureBodyAcceleration(); bool positionSuccess; - _entity->setPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset(), positionSuccess, false); + _entity->setWorldPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset(), positionSuccess, false); if (!positionSuccess) { static QString repeatedMessage = LogHandler::getInstance().addRepeatedMessageRegex("EntityMotionState::setWorldTransform " diff --git a/libraries/physics/src/EntityMotionState.h b/libraries/physics/src/EntityMotionState.h index 968f53700c..839309e60e 100644 --- a/libraries/physics/src/EntityMotionState.h +++ b/libraries/physics/src/EntityMotionState.h @@ -57,7 +57,7 @@ public: virtual float getObjectLinearDamping() const override { return _entity->getDamping(); } virtual float getObjectAngularDamping() const override { return _entity->getAngularDamping(); } - virtual glm::vec3 getObjectPosition() const override { return _entity->getPosition() - ObjectMotionState::getWorldOffset(); } + virtual glm::vec3 getObjectPosition() const override { return _entity->getWorldPosition() - ObjectMotionState::getWorldOffset(); } virtual glm::quat getObjectRotation() const override { return _entity->getRotation(); } virtual glm::vec3 getObjectLinearVelocity() const override { return _entity->getVelocity(); } virtual glm::vec3 getObjectAngularVelocity() const override { return _entity->getAngularVelocity(); } diff --git a/libraries/physics/src/ObjectActionTractor.cpp b/libraries/physics/src/ObjectActionTractor.cpp index 1a1790b0e0..6ab7daae7f 100644 --- a/libraries/physics/src/ObjectActionTractor.cpp +++ b/libraries/physics/src/ObjectActionTractor.cpp @@ -55,7 +55,7 @@ bool ObjectActionTractor::getTarget(float deltaTimeStep, glm::quat& rotation, gl if (!_otherID.isNull()) { if (other) { rotation = _desiredRotationalTarget * other->getRotation(); - position = other->getRotation() * _desiredPositionalTarget + other->getPosition(); + position = other->getRotation() * _desiredPositionalTarget + other->getWorldPosition(); } else { // we should have an "other" but can't find it, so disable the tractor. linearTimeScale = FLT_MAX; diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index b6f460cf39..3e87b9437d 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -223,7 +223,7 @@ void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& re if (numPoints > MAX_HULL_POINTS) { qWarning() << "convex hull with" << numPoints << "points for entity" << entity->getName() - << "at" << entity->getPosition() << " will be reduced"; + << "at" << entity->getWorldPosition() << " will be reduced"; } } btCollisionShape* shape = const_cast(ObjectMotionState::getShapeManager()->getShape(shapeInfo)); diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp index 8dbd2dd5e0..9713ce8a17 100644 --- a/libraries/shared/src/SpatiallyNestable.cpp +++ b/libraries/shared/src/SpatiallyNestable.cpp @@ -367,26 +367,26 @@ glm::vec3 SpatiallyNestable::localToWorldAngularVelocity(const glm::vec3& angula return parentTransform.getRotation() * angularVelocity; } -glm::vec3 SpatiallyNestable::getPosition(bool& success) const { +glm::vec3 SpatiallyNestable::getWorldPosition(bool& success) const { return getTransform(success).getTranslation(); } -glm::vec3 SpatiallyNestable::getPosition() const { +glm::vec3 SpatiallyNestable::getWorldPosition() const { bool success; - auto result = getPosition(success); + auto result = getWorldPosition(success); #ifdef WANT_DEBUG if (!success) { - qCDebug(shared) << "Warning -- getPosition failed" << getID(); + qCDebug(shared) << "Warning -- getWorldPosition failed" << getID(); } #endif return result; } -glm::vec3 SpatiallyNestable::getPosition(int jointIndex, bool& success) const { +glm::vec3 SpatiallyNestable::getWorldPosition(int jointIndex, bool& success) const { return getTransform(jointIndex, success).getTranslation(); } -void SpatiallyNestable::setPosition(const glm::vec3& position, bool& success, bool tellPhysics) { +void SpatiallyNestable::setWorldPosition(const glm::vec3& position, bool& success, bool tellPhysics) { // guard against introducing NaN into the transform if (isNaN(position)) { success = false; @@ -410,12 +410,12 @@ void SpatiallyNestable::setPosition(const glm::vec3& position, bool& success, bo } } -void SpatiallyNestable::setPosition(const glm::vec3& position) { +void SpatiallyNestable::setWorldPosition(const glm::vec3& position) { bool success; - setPosition(position, success); + setWorldPosition(position, success); #ifdef WANT_DEBUG if (!success) { - qCDebug(shared) << "Warning -- setPosition failed" << getID(); + qCDebug(shared) << "Warning -- setWorldPosition failed" << getID(); } #endif } @@ -624,7 +624,7 @@ const Transform SpatiallyNestable::getTransform(int jointIndex, bool& success, i bool setPositionSuccess; AACube aaCube = getQueryAACube(setPositionSuccess); if (setPositionSuccess) { - _this->setPosition(aaCube.calcCenter()); + _this->setWorldPosition(aaCube.calcCenter()); } return jointInWorldFrame; } @@ -958,7 +958,7 @@ void SpatiallyNestable::locationChanged(bool tellPhysics) { } AACube SpatiallyNestable::getMaximumAACube(bool& success) const { - return AACube(getPosition(success) - glm::vec3(defaultAACubeSize / 2.0f), defaultAACubeSize); + return AACube(getWorldPosition(success) - glm::vec3(defaultAACubeSize / 2.0f), defaultAACubeSize); } const float PARENTED_EXPANSION_FACTOR = 3.0f; @@ -1044,7 +1044,7 @@ AACube SpatiallyNestable::getQueryAACube(bool& success) const { } success = false; bool getPositionSuccess; - return AACube(getPosition(getPositionSuccess) - glm::vec3(defaultAACubeSize / 2.0f), defaultAACubeSize); + return AACube(getWorldPosition(getPositionSuccess) - glm::vec3(defaultAACubeSize / 2.0f), defaultAACubeSize); } AACube SpatiallyNestable::getQueryAACube() const { diff --git a/libraries/shared/src/SpatiallyNestable.h b/libraries/shared/src/SpatiallyNestable.h index 37f6cfdfd9..6b082fed82 100644 --- a/libraries/shared/src/SpatiallyNestable.h +++ b/libraries/shared/src/SpatiallyNestable.h @@ -78,10 +78,10 @@ public: virtual Transform getParentTransform(bool& success, int depth = 0) const; - virtual glm::vec3 getPosition(bool& success) const; - virtual glm::vec3 getPosition() const; - virtual void setPosition(const glm::vec3& position, bool& success, bool tellPhysics = true); - virtual void setPosition(const glm::vec3& position); + virtual glm::vec3 getWorldPosition(bool& success) const; + virtual glm::vec3 getWorldPosition() const; + virtual void setWorldPosition(const glm::vec3& position, bool& success, bool tellPhysics = true); + virtual void setWorldPosition(const glm::vec3& position); virtual glm::quat getOrientation(bool& success) const; virtual glm::quat getOrientation() const; @@ -122,7 +122,7 @@ public: // get world-frame values for a specific joint virtual const Transform getTransform(int jointIndex, bool& success, int depth = 0) const; - virtual glm::vec3 getPosition(int jointIndex, bool& success) const; + virtual glm::vec3 getWorldPosition(int jointIndex, bool& success) const; virtual glm::vec3 getSNScale(int jointIndex, bool& success) const; // object's parent's frame