After completing the FPS C++ tutorial I started playing around and wanted to let the projectiles shatter stuff in AFPSProjectile::OnHit(..)
My targets are from type ADestructibleActor
and shatter when falling, damage threshold is set to 1.0f, but I get only my debug message on screen. Here is the code:
void AFPSProjectile::OnHit(class AActor* OtherActor, ..)
{
// snip
ADestructibleActor* pDestructible(Cast<ADestructibleActor>(OtherActor));
if (pDestructible)
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, "Hit destructible");
FDamageEvent damageEvent;
pDestructible->TakeDamage(10.0f, damageEvent, _pController, this);
}
}
_pController is set to the AFPSCharacter.Controller after spawning the projectile.
Has someone any idea what I am missing/doing wrong?