From 6dbbf16a41d41b1af921307105c6d449117da455 Mon Sep 17 00:00:00 2001 From: Kalle Bladin Date: Wed, 25 May 2016 16:28:41 -0400 Subject: [PATCH] Movement speed is dependent on distance to bounding sphere. --- src/interaction/interactionhandler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/interaction/interactionhandler.cpp b/src/interaction/interactionhandler.cpp index bb4d0e8041..5c4c4f0416 100644 --- a/src/interaction/interactionhandler.cpp +++ b/src/interaction/interactionhandler.cpp @@ -801,7 +801,11 @@ void OrbitalInteractionMode::updateCameraStateFromMouseStates() { glm::normalize(glm::quat_cast(glm::inverse(lookAtMat))); } { // Move position towards or away from focus node - newPosition += -posDiff * _truckMovementMouseState.velocity.get().y; + glm::dvec3 centerToBoundingSphere = + glm::normalize(posDiff) * + static_cast(_focusNode->boundingSphere().lengthf()); + newPosition += -(posDiff + centerToBoundingSphere) * + _truckMovementMouseState.velocity.get().y; } { // Do roll glm::dquat cameraRollRotation = @@ -843,7 +847,7 @@ InteractionHandler::InteractionHandler() _inputState = std::shared_ptr(new InputState()); _interactor = std::shared_ptr( - new OrbitalInteractionMode(_inputState, 0.01, 0.02)); + new OrbitalInteractionMode(_inputState, 0.002, 0.02)); } InteractionHandler::~InteractionHandler() {