I’m very proud to nail the challenge without the hint
But I could’nt understand the syntax ```
for (auto& Str : StrArr) I guess I’ll learn in the VDO
I used the classic ```
for (int32 Index = 0; Index != StrArr.Num(); ++Index)
Here My Code:
float UOpenDoor::GetTotalMassOfActor() {
float TotalMass = 0.0f;
//find overlapping actors
TArray<AActor*> OverlappingActors;
PressurePlate->GetOverlappingActors(OUT OverlappingActors);
// iterate through their masses
for (int32 Index = 0; Index != OverlappingActors.Num(); ++Index)
{
TotalMass = OverlappingActors[Index]->FindComponentByClass<UPrimitiveComponent>()->GetMass() + TotalMass;
FString ObjectName = OverlappingActors[Index]->GetName();
UE_LOG(LogTemp, Warning, TEXT("Overlapping Actor(s): %s "), *ObjectName);
}
FString TheFloatStr = FString::SanitizeFloat(TotalMass);
UE_LOG(LogTemp, Warning, TEXT("Total Mass: %s "), *TheFloatStr);
return TotalMass;
}```