Unreal Engine C++ Course | ENG
  • About course
  • Links
    • Git
    • Visual Studio
    • Unreal Engine
  • Unreal Editor Hotkeys
  • Visual Studio Hotkeys
  • Console commands
  • Problems and solutions
    • Unable to start program error
  • Lessons
    • Lecture 065
      • Additive animation upon landing
      • Blocking shooting while running
    • Lecture 079
      • Pickup is visible after the ammo has been taken
      • Ammo is not picked up if character spends ammo at the pickup respawn point
    • Lecture 089
      • NiagaraSystem does not attach to muzzle
    • Lecture 148
    • Lecture 155
  • UE5
  • Automation
    • Code formatting
  • Student projects
Powered by GitBook
On this page

Was this helpful?

  1. Lessons

Lecture 155

Additionally, you need to change the FDamageEvent character in the OnGroundLandedfunction 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);
}
PreviousLecture 148NextUE5

Last updated 3 years ago

Was this helpful?