I currently have a blueprint which has 3 static mesh components in it. Each of them is positioned and will be used to test for collisions. However, when getting the components in code, I can’t seem to find a way to get the location of them to do my distance check against:
TArray<UStaticMeshComponent*> comps;
ObjectsDummyPts->GetComponents(comps);
FVector point0Location = FVector(0, 0, 0);
// Doesn't work
comps[1]->GetComponenTransform().TransformPosition(point0Location);
// Run-time Error
AStaticMeshActor* theMeshActor = Cast<AStaticMeshActor>(comps[1]);
point0Location = theMeshActor->GetActorLocation();
float distance = FVector::Dist(point0Location, ObjToTestCollision->GetActorLocation());
if (distance < radiusCheck) ...
So is there any way to get the location of these UStaticMeshComponents from within code?