Lecture 155
Additionally, you need to change the FDamageEvent
character in the OnGroundLanded
function to FPointDamageEvent
Thus, in the final, the function should look like this:
void ASTUBaseCharacter::OnGroundLanded(const FHitResult& Hit)
{
const auto FallVelocityZ = -GetVelocity().Z;
if (FallVelocityZ < LandedDamageVelocity.X) return;
const auto FallDamage = FMath::GetMappedRangeValueClamped(LandedDamageVelocity, LandedDamage, FallVelocityZ);
TakeDamage(FallDamage, FPointDamageEvent{}, nullptr, nullptr);
UE_LOG(LogBaseCharacter, Display, TEXT("Player %s recived landed damage: %f"), *GetName(), FallDamage);
}
Last updated
Was this helpful?