There should be something obvious, but I just couldn’t find it. Thanks for your help.
float UOpenDoor::GetTotalActorsMassOnPlate() {
float TotalMass = 0.f;
//Find what's on the pressure plate
TArray <AActor*> OverlappingActors;
PressurePlate->GetOverlappingActors(OUT OverlappingActors);
//iterate actors on plate to get the total mass
for (int32 Index = 0; Index != 3; ++Index)
{
//TotalMass += OverlappingActors[Index]->FindComponentByClass<UPrimitiveComponent>()->GetMass();
//UE_LOG(LogTemp, Warning, TEXT("%s on pressure plate"), *OverlappingActors[Index]->GetName());
TotalMass += 16.f;
}
return TotalMass;
}