From a5fb0c804fa77ecb9bce1abc3072cbe47f886ed3 Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 18 Jun 2013 16:56:49 +0200 Subject: [PATCH] Small improvements to FirstScene's camera Former-commit-id: 80545964ee9ab8693f43992b4c4a2610e93e78c9 --- examples/FirstScene/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/FirstScene/main.cpp b/examples/FirstScene/main.cpp index 7a492ac20..e0bf7680f 100644 --- a/examples/FirstScene/main.cpp +++ b/examples/FirstScene/main.cpp @@ -391,7 +391,7 @@ NzVector3f DampedString(const NzVector3f& currentPos, const NzVector3f& targetPo float displacementLength = displacement.GetLength(); // Stops small position fluctuations (integration errors probably - since only using euler) - if (displacementLength < 0.0001f) + if (NzNumberEquals(displacementLength, 0.f)) return currentPos; float invDisplacementLength = 1.f/displacementLength; @@ -403,7 +403,7 @@ NzVector3f DampedString(const NzVector3f& currentPos, const NzVector3f& targetPo // Normalise the displacement and scale by the spring magnitude // and the amount of time passed - float scalar = invDisplacementLength * springMagitude * frametime; + float scalar = std::min(invDisplacementLength * springMagitude * frametime, 1.f); displacement *= scalar; // move the camera a bit towards the target