OffsetCameraPosition.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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/ICameraTransformBehavior.h>
  10. #include <AzCore/Math/Transform.h>
  11. #include <AzCore/RTTI/ReflectContext.h>
  12. #include <AzCore/Memory/SystemAllocator.h>
  13. namespace Camera
  14. {
  15. //////////////////////////////////////////////////////////////////////////
  16. /// Use this behavior to offset the camera's position by a fixed amount
  17. //////////////////////////////////////////////////////////////////////////
  18. class OffsetCameraPosition
  19. : public ICameraTransformBehavior
  20. {
  21. public:
  22. ~OffsetCameraPosition() override = default;
  23. AZ_RTTI(OffsetCameraPosition, "{DB64D5DA-84B7-45B7-B221-B5A07BDA2F69}", ICameraTransformBehavior)
  24. AZ_CLASS_ALLOCATOR(OffsetCameraPosition, AZ::SystemAllocator);
  25. static void Reflect(AZ::ReflectContext* reflection);
  26. //////////////////////////////////////////////////////////////////////////
  27. // ICameraTransformBehavior
  28. void AdjustCameraTransform(float deltaTime, const AZ::Transform& initialCameraTransform, const AZ::Transform& targetTransform, AZ::Transform& inOutCameraTransform) override;
  29. void Activate(AZ::EntityId) override {}
  30. void Deactivate() override {}
  31. private:
  32. //////////////////////////////////////////////////////////////////////////
  33. // Reflected Data
  34. AZ::Vector3 m_offset = AZ::Vector3::CreateZero();
  35. bool m_isRelativeOffset = false;
  36. };
  37. } // namespace Camera