From f3c1878a8b41af214fce61b89b61b9a8c79c5222 Mon Sep 17 00:00:00 2001 From: greerdv Date: Fri, 14 May 2021 21:07:22 +0100 Subject: [PATCH 1/2] fix bug with not clearing shape collider config when shape component is removed --- Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp index 58b8995281..82a38a04c2 100644 --- a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp @@ -326,6 +326,7 @@ namespace PhysX else { m_shapeType = !shapeCrc ? ShapeType::None : ShapeType::Unsupported; + m_shapeConfigs.clear(); AZ_Warning("PhysX Shape Collider Component", m_shapeTypeWarningIssued, "Unsupported shape type for " "entity \"%s\". The following shapes are currently supported - box, capsule, sphere, polygon prism.", GetEntity()->GetName().c_str()); From 05619f9244478d3701d8716e91104749596fc6ad Mon Sep 17 00:00:00 2001 From: greerdv Date: Sat, 15 May 2021 12:25:46 +0100 Subject: [PATCH 2/2] move non-uniform scale update after bus connection in polygon prism activation --- Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp index 95d4366a13..3ea8f2a3d0 100644 --- a/Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp +++ b/Gems/LmbrCentral/Code/Source/Shape/PolygonPrismShape.cpp @@ -215,10 +215,6 @@ namespace LmbrCentral m_entityId = entityId; m_currentTransform = AZ::Transform::CreateIdentity(); AZ::TransformBus::EventResult(m_currentTransform, entityId, &AZ::TransformBus::Events::GetWorldTM); - m_currentNonUniformScale = AZ::Vector3::CreateOne(); - AZ::NonUniformScaleRequestBus::EventResult(m_currentNonUniformScale, m_entityId, &AZ::NonUniformScaleRequests::GetScale); - m_polygonPrism->SetNonUniformScale(m_currentNonUniformScale); - m_intersectionDataCache.InvalidateCache(InvalidateShapeCacheReason::ShapeChange); AZ::TransformNotificationBus::Handler::BusConnect(entityId); ShapeComponentRequestsBus::Handler::BusConnect(entityId); @@ -226,6 +222,11 @@ namespace LmbrCentral AZ::VariableVerticesRequestBus::Handler::BusConnect(entityId); AZ::FixedVerticesRequestBus::Handler::BusConnect(entityId); + m_currentNonUniformScale = AZ::Vector3::CreateOne(); + AZ::NonUniformScaleRequestBus::EventResult(m_currentNonUniformScale, m_entityId, &AZ::NonUniformScaleRequests::GetScale); + m_polygonPrism->SetNonUniformScale(m_currentNonUniformScale); + m_intersectionDataCache.InvalidateCache(InvalidateShapeCacheReason::ShapeChange); + AZ::NonUniformScaleRequestBus::Event(m_entityId, &AZ::NonUniformScaleRequests::RegisterScaleChangedEvent, m_nonUniformScaleChangedHandler);