ColliderTranslationManipulators.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 <AzToolsFramework/Manipulators/TranslationManipulators.h>
  10. #include <Editor/Plugins/Ragdoll/PhysicsSetupManipulatorCommandCallback.h>
  11. #include <Editor/Plugins/Ragdoll/PhysicsSetupManipulators.h>
  12. #include <MCore/Source/Command.h>
  13. #include <MCore/Source/MCoreCommandManager.h>
  14. namespace EMotionFX
  15. {
  16. //! Provides functionality for interactively editing character physics collider positions in the Animation Editor Viewport.
  17. class ColliderTranslationManipulators
  18. : public PhysicsSetupManipulatorsBase
  19. , private PhysicsSetupManipulatorRequestBus::Handler
  20. {
  21. public:
  22. ColliderTranslationManipulators();
  23. void Setup(const PhysicsSetupManipulatorData& physicsSetupManipulatorData) override;
  24. void Refresh() override;
  25. void Teardown() override;
  26. void ResetValues() override;
  27. private:
  28. AZ::Vector3 GetPosition(const AZ::Vector3& startPosition, const AZ::Vector3& offset) const;
  29. void OnManipulatorMoved(const AZ::Vector3& startPosition, const AZ::Vector3& offset);
  30. void BeginEditing(const AZ::Vector3& startPosition, const AZ::Vector3& offset);
  31. void EndEditing(const AZ::Vector3& startPosition, const AZ::Vector3& offset);
  32. // PhysicsSetupManipulatorRequestBus::Handler overrides ...
  33. void OnUnderlyingPropertiesChanged() override;
  34. MCore::CommandGroup m_commandGroup;
  35. PhysicsSetupManipulatorData m_physicsSetupManipulatorData;
  36. AzToolsFramework::TranslationManipulators m_translationManipulators;
  37. AZStd::unique_ptr<PhysicsSetupManipulatorCommandCallback> m_adjustColliderCallback;
  38. };
  39. } // namespace EMotionFX