From b408635a01322e5542543cec8864783bbf7e83eb Mon Sep 17 00:00:00 2001 From: greerdv Date: Thu, 14 Oct 2021 11:24:38 +0100 Subject: [PATCH 1/3] mark not yet supported shapes incompatible with shape collider component, fixes 3031 Signed-off-by: greerdv --- .../PhysX/Code/Source/EditorShapeColliderComponent.cpp | 10 ++++++++-- .../Code/Source/Components/ReferenceShapeComponent.cpp | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp index 2bbc04faae..ecd3c599aa 100644 --- a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp @@ -120,8 +120,14 @@ namespace PhysX void EditorShapeColliderComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) { - incompatible.push_back(AZ_CRC("LegacyCryPhysicsService", 0xbb370351)); - incompatible.push_back(AZ_CRC("PhysXShapeColliderService", 0x98a7e779)); + incompatible.push_back(AZ_CRC_CE("LegacyCryPhysicsService")); + incompatible.push_back(AZ_CRC_CE("PhysXShapeColliderService")); + incompatible.push_back(AZ_CRC_CE("AxisAlignedBoxShapeService")); + incompatible.push_back(AZ_CRC_CE("CompoundShapeService")); + incompatible.push_back(AZ_CRC_CE("DiskShapeService")); + incompatible.push_back(AZ_CRC_CE("QuadShapeService")); + incompatible.push_back(AZ_CRC_CE("TubeShapeService")); + incompatible.push_back(AZ_CRC_CE("VegetationReferenceShapeService")); } const AZStd::vector& EditorShapeColliderComponent::GetSamplePoints() const diff --git a/Gems/Vegetation/Code/Source/Components/ReferenceShapeComponent.cpp b/Gems/Vegetation/Code/Source/Components/ReferenceShapeComponent.cpp index 5700abb7cb..4601efc1d4 100644 --- a/Gems/Vegetation/Code/Source/Components/ReferenceShapeComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/ReferenceShapeComponent.cpp @@ -50,6 +50,7 @@ namespace Vegetation void ReferenceShapeComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services) { services.push_back(AZ_CRC("ShapeService", 0xe86aa5fe)); + services.push_back(AZ_CRC_CE("VegetationReferenceShapeService")); } void ReferenceShapeComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services) From 55c033333eafe1ad53c77909c5d7c8f9bfd7a465 Mon Sep 17 00:00:00 2001 From: greerdv Date: Thu, 14 Oct 2021 18:43:32 +0100 Subject: [PATCH 2/3] feedback from PR Signed-off-by: greerdv --- Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp | 2 +- .../Code/Source/Components/ReferenceShapeComponent.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp index ecd3c599aa..2ea6f4eaf5 100644 --- a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp @@ -127,7 +127,7 @@ namespace PhysX incompatible.push_back(AZ_CRC_CE("DiskShapeService")); incompatible.push_back(AZ_CRC_CE("QuadShapeService")); incompatible.push_back(AZ_CRC_CE("TubeShapeService")); - incompatible.push_back(AZ_CRC_CE("VegetationReferenceShapeService")); + incompatible.push_back(AZ_CRC_CE("ReferenceShapeService")); } const AZStd::vector& EditorShapeColliderComponent::GetSamplePoints() const diff --git a/Gems/Vegetation/Code/Source/Components/ReferenceShapeComponent.cpp b/Gems/Vegetation/Code/Source/Components/ReferenceShapeComponent.cpp index 4601efc1d4..620e43457d 100644 --- a/Gems/Vegetation/Code/Source/Components/ReferenceShapeComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/ReferenceShapeComponent.cpp @@ -50,7 +50,7 @@ namespace Vegetation void ReferenceShapeComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services) { services.push_back(AZ_CRC("ShapeService", 0xe86aa5fe)); - services.push_back(AZ_CRC_CE("VegetationReferenceShapeService")); + services.push_back(AZ_CRC_CE("ReferenceShapeService")); } void ReferenceShapeComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services) From c0f73faaaedc47c62bc1fdb9b727185d6e2e2806 Mon Sep 17 00:00:00 2001 From: greerdv Date: Mon, 18 Oct 2021 11:47:41 +0100 Subject: [PATCH 3/3] remove no longer useful test Signed-off-by: greerdv --- .../Tests/ShapeColliderComponentTests.cpp | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp b/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp index cbaf4b4625..fce427d9d3 100644 --- a/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp +++ b/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp @@ -338,33 +338,6 @@ namespace PhysXEditorTests ValidateInvalidEditorShapeColliderComponentParams(0.f, -1.f); } - TEST_F(PhysXEditorFixture, EditorShapeColliderComponent_ShapeColliderWithUnsupportedShape_HandledGracefully) - { - UnitTest::ErrorHandler unsupportedShapeWarningHandler("Unsupported shape"); - UnitTest::ErrorHandler rigidBodyWarningHandler("No Collider or Shape information found when creating Rigid body"); - - // create an editor entity with a shape collider component and a cylinder shape component - // the cylinder shape is not currently supported by the shape collider component - EntityPtr editorEntity = CreateInactiveEditorEntity("ShapeColliderComponentEditorEntity"); - editorEntity->CreateComponent(); - editorEntity->CreateComponent(LmbrCentral::EditorCompoundShapeComponentTypeId); - editorEntity->Activate(); - - EXPECT_EQ(unsupportedShapeWarningHandler.GetExpectedWarningCount(), 1); - EXPECT_EQ(rigidBodyWarningHandler.GetExpectedWarningCount(), 1); - - EntityPtr gameEntity = CreateActiveGameEntityFromEditorEntity(editorEntity.get()); - - // since there was no editor rigid body component, the runtime entity should have a static rigid body - const auto* staticBody = azdynamic_cast(gameEntity->FindComponent()->GetSimulatedBody()); - const auto* pxRigidStatic = static_cast(staticBody->GetNativePointer()); - - PHYSX_SCENE_READ_LOCK(pxRigidStatic->getScene()); - - // there should be no shapes on the rigid body because the cylinder is not supported - EXPECT_EQ(pxRigidStatic->getNbShapes(), 0); - } - TEST_F(PhysXEditorFixture, EditorShapeColliderComponent_ShapeColliderWithBoxAndRigidBody_CorrectRuntimeComponents) { // create an editor entity with a shape collider component and a box shape component