void AMovingPlatform::GetMeshComponentLocation()
{
if(MeshComponent)
{
return;
}
UGameplayStatics::GetAllActorsOfClass(GetWorld(), UStaticMeshComponent::StaticClass(), FoundActors);
for (AActor* Actor : FoundActors)
{
if (UStaticMeshComponent* StaticMeshComponent = Cast<UStaticMeshComponent>(Actor))
{
if (UStaticMesh* StaticMesh = StaticMeshComponent->StaticMesh())
{
if (TestComponent->GetName() == "SM_FloatingIsland_S")
{
MeshComponent = TestComponent;
break;
}
}
}
}
I want to fetch location of a StaticMeshComponent of a floatinginland but I can’t get it no matter how much I tired.
I tried by GetAllActorsofClass but failed to fetch. I want to move one object from one original place to wherever the inland is located. Inland is dynamic location so I want to fetch by name