UGameplayStatics::ApplyPointDamage
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallableBlueprintAuthorityOnly
Description
Deals point damage to a specific actor, including directional hit information. This is the correct function to use after a line trace hit — it propagates the FHitResult so hit-reactive systems (e.g., Chaos physics, bone-level hit reactions) can use location and component data.
Caveats & Gotchas
- • BlueprintAuthorityOnly — must be called on the server. Clients calling this will have the call silently ignored.
- • The return value is the actual damage applied after the target actor's TakeDamage override processes it, which may be 0 if the actor is invulnerable or dead.
- • Passing a zero vector for HitFromDirection is valid but prevents directional-dependent systems (such as directional hit animations) from working correctly — always pass the real shot direction when available.
Signature
static ENGINE_API float ApplyPointDamage(AActor* DamagedActor, float BaseDamage, const FVector& HitFromDirection, const FHitResult& HitInfo, AController* EventInstigator, AActor* DamageCauser, TSubclassOf<class UDamageType> DamageTypeClass); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| DamagedActor | AActor* | The actor to damage. | — |
| BaseDamage | float | Amount of damage to apply before the damage type modifier. | — |
| HitFromDirection | const FVector& | Normalized direction vector indicating where the hit came from. | — |
| HitInfo | const FHitResult& | Hit result from the trace or sweep that produced this damage event. | — |
| EventInstigator | AController* | Controller responsible for the damage event. | — |
| DamageCauser | AActor* | The actor that physically caused the damage (e.g., a projectile). | — |
| DamageTypeClass | TSubclassOf<class UDamageType> | Class describing the type of damage inflicted. | — |
Return Type
float Example
Apply damage after a projectile hit C++
void AMyProjectile::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
if (OtherActor && HasAuthority())
{
UGameplayStatics::ApplyPointDamage(
OtherActor,
DamageAmount,
GetVelocity().GetSafeNormal(),
Hit,
GetInstigatorController(),
this,
UDamageType::StaticClass()
);
}
Destroy();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?