From 5ceb80b3e7b9bafebb70ea47a759d0e0b7e9b7f8 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 29 Jun 2017 09:58:37 -0700 Subject: [PATCH] It's working! --- interface/src/SecondaryCamera.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/interface/src/SecondaryCamera.cpp b/interface/src/SecondaryCamera.cpp index 3adae61aaa..178286f614 100644 --- a/interface/src/SecondaryCamera.cpp +++ b/interface/src/SecondaryCamera.cpp @@ -57,19 +57,8 @@ public: void configure(const Config& config) { if (config.enabled || config.alwaysEnabled) { _attachedEntityId = config.attachedEntityId; - if (_attachedEntityId != QUuid()) { - auto entityScriptingInterface = DependencyManager::get(); - EntityPropertyFlags entityPropertyFlags; - entityPropertyFlags += PROP_POSITION; - entityPropertyFlags += PROP_ROTATION; - EntityItemProperties entityProperties = entityScriptingInterface->getEntityProperties(config.attachedEntityId, entityPropertyFlags); - - _position = entityProperties.getPosition(); - _orientation = entityProperties.getRotation(); - } else { - _position = config.position; - _orientation = config.orientation; - } + _position = config.position; + _orientation = config.orientation; _vFoV = config.vFoV; _nearClipPlaneDistance = config.nearClipPlaneDistance; _farClipPlaneDistance = config.farClipPlaneDistance; @@ -97,8 +86,19 @@ public: }); auto srcViewFrustum = args->getViewFrustum(); - srcViewFrustum.setPosition(_position); - srcViewFrustum.setOrientation(_orientation); + if (_attachedEntityId != QUuid()) { + auto entityScriptingInterface = DependencyManager::get(); + EntityPropertyFlags entityPropertyFlags; + entityPropertyFlags += PROP_POSITION; + entityPropertyFlags += PROP_ROTATION; + EntityItemProperties entityProperties = entityScriptingInterface->getEntityProperties(_attachedEntityId, entityPropertyFlags); + + srcViewFrustum.setPosition(entityProperties.getPosition()); + srcViewFrustum.setOrientation(entityProperties.getRotation()); + } else { + srcViewFrustum.setPosition(_position); + srcViewFrustum.setOrientation(_orientation); + } srcViewFrustum.setProjection(glm::perspective(glm::radians(_vFoV), ((float)args->_viewport.z / (float)args->_viewport.w), _nearClipPlaneDistance, _farClipPlaneDistance)); // Without calculating the bound planes, the secondary camera will use the same culling frustum as the main camera, // which is not what we want here.