Cloth works with Actors in Atom. Cloth system uses MeshAssetHelper to read model mesh information for actors too.

This commit is contained in:
moraaar
2021-04-16 18:24:29 +01:00
parent 41eadd60e4
commit 808fd1d3ba
6 changed files with 41 additions and 67 deletions
+3 -23
View File
@@ -13,11 +13,7 @@
#include <Utils/AssetHelper.h>
#include <Utils/MeshAssetHelper.h>
#include <Utils/ActorAssetHelper.h>
#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentBus.h>
#include <Integration/ActorComponentBus.h>
namespace NvCloth
{
@@ -30,25 +26,9 @@ namespace NvCloth
AZStd::unique_ptr<AssetHelper> AssetHelper::CreateAssetHelper(AZ::EntityId entityId)
{
// Does the entity have an Actor Asset?
EMotionFX::ActorInstance* actorInstance = nullptr;
EMotionFX::Integration::ActorComponentRequestBus::EventResult(
actorInstance, entityId, &EMotionFX::Integration::ActorComponentRequestBus::Events::GetActorInstance);
if (actorInstance)
{
return AZStd::make_unique<ActorAssetHelper>(entityId);
}
AZ::Data::Asset<AZ::RPI::ModelAsset> modelAsset;
AZ::Render::MeshComponentRequestBus::EventResult(
modelAsset, entityId, &AZ::Render::MeshComponentRequestBus::Events::GetModelAsset);
if (modelAsset.GetId().IsValid())
{
return AZStd::make_unique<MeshAssetHelper>(entityId);
}
AZ_Warning("AssetHelper", false, "Unexpected asset type");
return nullptr;
return entityId.IsValid()
? AZStd::make_unique<MeshAssetHelper>(entityId)
: nullptr;
}
float AssetHelper::ConvertBackstopOffset(float backstopOffset)