diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ComponentModes/BoxViewportEdit.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ComponentModes/BoxViewportEdit.cpp index 19d19563f9..8c47bfc797 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ComponentModes/BoxViewportEdit.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ComponentModes/BoxViewportEdit.cpp @@ -14,6 +14,8 @@ #include #include #include +#include +#include namespace AzToolsFramework { @@ -37,12 +39,12 @@ namespace AzToolsFramework void BoxViewportEdit::UpdateManipulators() { AZ::Transform boxWorldFromLocal = AZ::Transform::CreateIdentity(); - BoxManipulatorRequestBus::EventResult( - boxWorldFromLocal, m_entityComponentIdPair, &BoxManipulatorRequests::GetCurrentTransform); + AZ::TransformBus::EventResult( + boxWorldFromLocal, m_entityComponentIdPair.GetEntityId(), &AZ::TransformBus::Events::GetWorldTM); AZ::Vector3 nonUniformScale = AZ::Vector3::CreateOne(); - BoxManipulatorRequestBus::EventResult( - nonUniformScale, m_entityComponentIdPair, &BoxManipulatorRequests::GetCurrentNonUniformScale); + AZ::NonUniformScaleRequestBus::EventResult( + nonUniformScale, m_entityComponentIdPair.GetEntityId(), &AZ::NonUniformScaleRequests::GetScale); AZ::Vector3 boxDimensions = AZ::Vector3::CreateZero(); BoxManipulatorRequestBus::EventResult( @@ -70,8 +72,8 @@ namespace AzToolsFramework m_entityComponentIdPair = entityComponentIdPair; AZ::Transform worldFromLocal = AZ::Transform::CreateIdentity(); - BoxManipulatorRequestBus::EventResult( - worldFromLocal, entityComponentIdPair, &BoxManipulatorRequests::GetCurrentTransform); + AZ::TransformBus::EventResult( + worldFromLocal, entityComponentIdPair.GetEntityId(), &AZ::TransformBus::Events::GetWorldTM); for (size_t manipulatorIndex = 0; manipulatorIndex < m_linearManipulators.size(); ++manipulatorIndex) { @@ -98,8 +100,8 @@ namespace AzToolsFramework boxLocalTransform, entityComponentIdPair, &BoxManipulatorRequests::GetCurrentLocalTransform); AZ::Transform boxWorldTransform = AZ::Transform::CreateIdentity(); - BoxManipulatorRequestBus::EventResult( - boxWorldTransform, entityComponentIdPair, &BoxManipulatorRequests::GetCurrentTransform); + AZ::TransformBus::EventResult( + boxWorldTransform, m_entityComponentIdPair.GetEntityId(), &AZ::TransformBus::Events::GetWorldTM); float boxScale = AZ::GetMax(AZ::MinTransformScale, boxWorldTransform.GetUniformScale()); // calculate the position of the manipulator in the reference frame of the box diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/BoxManipulatorRequestBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/BoxManipulatorRequestBus.h index f1440e3d55..359b92502e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/BoxManipulatorRequestBus.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/BoxManipulatorRequestBus.h @@ -26,22 +26,25 @@ namespace AzToolsFramework virtual AZ::Vector3 GetDimensions() = 0; //! Set the X/Y/Z dimensions of the box shape/collider. virtual void SetDimensions(const AZ::Vector3& dimensions) = 0; + //! @deprecated Because non-uniform scale effects can be complex, it is recommended to separately use + //! AZ::TransformBus::Events::GetWorldTM, AZ::NonUniformScaleRequests::GetScale and GetCurrentLocalTransform + //! and combine their effects. //! Get the transform of the box shape/collider. //! This is used by \ref BoxComponentMode instead of the \ref \AZ::TransformBus //! because a collider may have an additional translation/orientation offset from //! the Entity transform. virtual AZ::Transform GetCurrentTransform() = 0; - //! - //! + //! Get the transform of the box relative to the entity. virtual AZ::Transform GetCurrentLocalTransform() = 0; + //! @deprecated Because non-uniform scale effects can be complex, it is recommended to separately use + //! AZ::TransformBus::Events::GetWorldTM, AZ::NonUniformScaleRequests::GetScale and GetCurrentLocalTransform + //! and combine their effects. //! Get the scale currently applied to the box. //! With the Box Shape, the largest x/y/z component is taken //! so scale is always uniform, with colliders the scale may //! be different per component. virtual AZ::Vector3 GetBoxScale() = 0; - virtual AZ::Vector3 GetCurrentNonUniformScale() { return AZ::Vector3::CreateOne(); } - protected: ~BoxManipulatorRequests() = default; }; diff --git a/Gems/PhysX/Code/Source/EditorColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorColliderComponent.cpp index 1adc4b941f..03e4bdb63e 100644 --- a/Gems/PhysX/Code/Source/EditorColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorColliderComponent.cpp @@ -1065,11 +1065,6 @@ namespace PhysX return AZ::Vector3::CreateOne(); } - AZ::Vector3 EditorColliderComponent::GetCurrentNonUniformScale() - { - return m_cachedNonUniformScale; - } - void EditorColliderComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world) { if (world.IsClose(m_cachedWorldTransform)) diff --git a/Gems/PhysX/Code/Source/EditorColliderComponent.h b/Gems/PhysX/Code/Source/EditorColliderComponent.h index 52d788ecef..bc3d4da6d9 100644 --- a/Gems/PhysX/Code/Source/EditorColliderComponent.h +++ b/Gems/PhysX/Code/Source/EditorColliderComponent.h @@ -173,7 +173,6 @@ namespace PhysX AZ::Transform GetCurrentTransform() override; AZ::Transform GetCurrentLocalTransform() override; AZ::Vector3 GetBoxScale() override; - AZ::Vector3 GetCurrentNonUniformScale() override; // AZ::Render::MeshComponentNotificationBus void OnModelReady(const AZ::Data::Asset& modelAsset,