3
0

DebugCameraUtils.cpp 977 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <DebugCameraUtils.h>
  9. #include <AzCore/Math/MathUtils.h>
  10. namespace AZ
  11. {
  12. namespace Debug
  13. {
  14. void ApplyMomentum(float& oldValue, float& newValue, float deltaTime)
  15. {
  16. float blendedValue;
  17. blendedValue = AZ::Lerp(newValue, oldValue, deltaTime);
  18. oldValue = blendedValue;
  19. newValue = blendedValue;
  20. }
  21. float NormalizeAngle(float angle)
  22. {
  23. if (angle > AZ::Constants::Pi)
  24. {
  25. angle -= AZ::Constants::TwoPi;
  26. }
  27. else if (angle < -AZ::Constants::Pi)
  28. {
  29. angle += AZ::Constants::TwoPi;
  30. }
  31. return angle;
  32. }
  33. } // namespace Debug
  34. } // namespace AZ