3
0

OffsetPosition.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #pragma once
  9. #include <CameraFramework/ICameraLookAtBehavior.h>
  10. #include <AzCore/RTTI/RTTI.h>
  11. #include <AzCore/Math/Vector3.h>
  12. #include <AzCore/Math/Transform.h>
  13. #include <AzCore/Memory/SystemAllocator.h>
  14. namespace AZ
  15. {
  16. class ReflectContext;
  17. }
  18. namespace Camera
  19. {
  20. //////////////////////////////////////////////////////////////////////////
  21. /// Offset Position will offset the current LookAt target transform by "Positional Offset"
  22. //////////////////////////////////////////////////////////////////////////
  23. class OffsetPosition
  24. : public ICameraLookAtBehavior
  25. {
  26. public:
  27. ~OffsetPosition() override = default;
  28. AZ_RTTI(OffsetPosition, "{5B2975A6-839B-4DE0-842B-EDE78D778BC9}", ICameraLookAtBehavior);
  29. AZ_CLASS_ALLOCATOR(OffsetPosition, AZ::SystemAllocator);
  30. static void Reflect(AZ::ReflectContext* reflection);
  31. //////////////////////////////////////////////////////////////////////////
  32. // ICameraLookAtBehavior
  33. void AdjustLookAtTarget(float deltaTime, const AZ::Transform& targetTransform, AZ::Transform& outLookAtTargetTransform) override;
  34. void Activate(AZ::EntityId) override {}
  35. void Deactivate() override {}
  36. private:
  37. AZ::Vector3 m_positionalOffset = AZ::Vector3::CreateZero();
  38. bool m_isRelativeOffset = false;
  39. };
  40. } // namespace Camera