My code is not adding the two actors weight together

I have been fighting with this problem for 2 weeks now. I have tried every solution that even looks close. My code is -
float UOpenDoor::GetTotalMassOfActorsOnPlate()
{
float TotalMass = 0.f;

//Find all the overlapping actors	
TArray<AActor*> OverlappingActors;
PressurePlate->GetOverlappingActors(OUT OverlappingActors);
//Total all their masses
for (const auto* Actor : OverlappingActors)
{
	TotalMass += Actor->FindComponentByClass<UPrimitiveComponent>()->GetMass();
	UE_LOG(LogTemp, Warning, TEXT("%s on pressure plate"), *Actor->GetName())
}

return TotalMass;

}

What is happening is that the first actor on my pressure plate is weighed. I never see the other actor or its weight. I think I have everything in here correctly but it just won’t work. I am using Unreal 4.18.3

ANSWER - Until I understand the engine better the fix I have for this is to make the volume for the pressure plate taller. This will force the volume to add all items together.
Now I do not believe that this is the final answer. I feel that with the code AND overlap events turned on you should be able to make anything added to the stack add together, no matter how tall the volume or stack is. If someone has a better answer, one that makes the code work as intended… at least the way I think it should be working… please let me know.

Privacy & Terms