Why do I receive the wrong weight of the Pawn, while the table and chairs weights are correct?
DefaultPawn_BP/Collisioncomponent/MassInKg = 70
float TotalMass = 0.f;
// find all the overlapping actors
TArray<AActor*> OverlappingActors;
PressurePlate->GetOverlappingActors(OUT OverlappingActors);
// iterate through them adding their masses
for (const auto* Actor : OverlappingActors)
{
TotalMass += Actor->FindComponentByClass<UPrimitiveComponent>()->GetMass();
UE_LOG(
LogTemp,
Warning,
TEXT("%s on pressure plate, mass = %s, actor total mass: %s"),
*Actor->GetName(),
*FString::SanitizeFloat(Actor->FindComponentByClass<UPrimitiveComponent>()->GetMass()),
*FString::SanitizeFloat(TotalMass)
);
}
One Default_Pawn:
LogTemp:Warning: DefaultPawn_BP_C_0 on pressure plate, mass = 119.059105, actor total mass: 119.059105
chair, table and pawn together:
LogTemp:Warning: SM_TableRound_2 on pressure plate, mass = 20.0, actor total mass: 20.0
LogTemp:Warning: SM_Chair_2 on pressure plate, mass = 14.999999, actor total mass: 35.0
LogTemp:Warning: DefaultPawn_BP_C_0 on pressure plate, mass = 119.059105, actor total mass: 154.059113
Is there a way to fix it?