Skip to content
Snippets Groups Projects
Commit 513886b8 authored by Ehret's avatar Ehret
Browse files

check for bones if multipe skeletalactors exist

parent 82c7bbf3
No related branches found
No related tags found
No related merge requests found
...@@ -127,18 +127,19 @@ void UVAAbstractSourceComponent::Initialize() ...@@ -127,18 +127,19 @@ void UVAAbstractSourceComponent::Initialize()
UpdateRate = ReceiverActorTmp->GetUpdateRate(); UpdateRate = ReceiverActorTmp->GetUpdateRate();
SkeletalMeshComponent = dynamic_cast<USkeletalMeshComponent*>(
GetOwner()->GetComponentByClass(USkeletalMeshComponent::StaticClass()));
if (MovementSetting == EMovement::AttachToBone) if (MovementSetting == EMovement::AttachToBone)
{ {
if (SkeletalMeshComponent != nullptr TArray<UActorComponent*> MeshComponents = GetOwner()->GetComponentsByClass(USkeletalMeshComponent::StaticClass());
&& SkeletalMeshComponent->DoesSocketExist(FName(*BoneName))) for(UActorComponent* Component : MeshComponents)
{ {
FVAUtils::LogStuff("[UVASourceComponent::Initialize()]: Bone " + BoneName + " detected.", false); USkeletalMeshComponent* MeshComp = Cast<USkeletalMeshComponent>(Component);
if(MeshComp && MeshComp->DoesSocketExist(FName(*BoneName)))
{
//found the right mesh component
SkeletalMeshComponent = MeshComp;
}
} }
else if (SkeletalMeshComponent == nullptr)
{ {
FVAUtils::OpenMessageBox("[UVASourceComponent::Initialize()]: Could not find bone " + FVAUtils::OpenMessageBox("[UVASourceComponent::Initialize()]: Could not find bone " +
BoneName + ", using MoveWithObject instead.", true); BoneName + ", using MoveWithObject instead.", true);
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment