ColliderBoxMode.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 "ColliderBoxMode.h"
  9. #include <AzToolsFramework/Manipulators/BoxManipulatorRequestBus.h>
  10. #include <AzToolsFramework/ComponentModes/BoxComponentMode.h>
  11. namespace PhysX
  12. {
  13. AZ_CLASS_ALLOCATOR_IMPL(ColliderBoxMode, AZ::SystemAllocator);
  14. ColliderBoxMode::ColliderBoxMode()
  15. {
  16. const bool allowAsymmetricalEditing = true;
  17. m_boxEdit = AZStd::make_unique<AzToolsFramework::BoxViewportEdit>(allowAsymmetricalEditing);
  18. }
  19. void ColliderBoxMode::Setup(const AZ::EntityComponentIdPair& idPair)
  20. {
  21. AzToolsFramework::InstallBaseShapeViewportEditFunctions(m_boxEdit.get(), idPair);
  22. AzToolsFramework::InstallBoxViewportEditFunctions(m_boxEdit.get(), idPair);
  23. m_boxEdit->Setup(AzToolsFramework::g_mainManipulatorManagerId);
  24. m_boxEdit->AddEntityComponentIdPair(idPair);
  25. }
  26. void ColliderBoxMode::Refresh([[maybe_unused]] const AZ::EntityComponentIdPair& idPair)
  27. {
  28. m_boxEdit->UpdateManipulators();
  29. }
  30. void ColliderBoxMode::Teardown([[maybe_unused]] const AZ::EntityComponentIdPair& idPair)
  31. {
  32. m_boxEdit->Teardown();
  33. }
  34. void ColliderBoxMode::ResetValues([[maybe_unused]] const AZ::EntityComponentIdPair& idPair)
  35. {
  36. m_boxEdit->ResetValues();
  37. }
  38. }