Quantcast
Channel: Why does ApplyRadialDamageWithFaloff applies full damage? - Game Development Stack Exchange
Viewing all articles
Browse latest Browse all 2

Why does ApplyRadialDamageWithFaloff applies full damage?

$
0
0

For some reason it applies full damage even when actor to damage is further than 100.0f from the MainDamageSphere. What can be the problem? I'm checking for damage with the usage of overriden "TakeDamage" function

AGrenadePauncherProjectile_CPP::OnHit

void AGrenadeLauncherProjectile_CPP::OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp,                                           FVector NormalImpulse, const FHitResult& Hit){    if (OtherActor != nullptr && OtherActor != this)    {        TArray<AActor*> ActorsToIgnore;        /*UGameplayStatics::ApplyRadialDamageWithFalloff(OtherActor, Damage, 1.0f, Hit.ImpactPoint, 100, 400,            1.0f, UDamageType::StaticClass(), ActorsToIgnore);*/        ExplosionClass->Initialize(SplashRadius, 100.0f, Damage, GetTransform(), OtherActor, ActorsToIgnore, this);        SoundSystem->PlaySoundUnsafe(*ExplosionSoundCue, GetActorLocation());    }    Destroy();}

UExplosion::Initialize

void UExplosion::Initialize(const float& SphereRadiusValue, const float& SphereRadiusValueInner, const float& SplashDamageValue,                             const FTransform Transform, AActor* ToDamage, TArray<AActor*> ActorsToIgnore, AActor* ProjectileActor){    if (ExplosionParticleSystem)    {        UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ExplosionParticleSystem, Transform, true, EPSCPoolMethod::None, true);        // decided to hardcode parameters for debug        UGameplayStatics::ApplyRadialDamageWithFalloff(ToDamage, SplashDamageValue, 1.0f, Transform.GetLocation(), 100, 400,                                                       1.0f, UDamageType::StaticClass(), ActorsToIgnore, ProjectileActor);    }       }

UPDATE

As far as I can see from disassembled code, ApplyRadialDamageWithFaloff calls procedure TakeDamage that belongs to my enemy actor(which needs to be damaged) and passes base damage instead of calculating new value relying on enemy's position inside of sphere...I attach a screenshot of disassembled code where you can see that xmm6 vector register holds a m128_f32 variable that has base damage and it moves it to xmm1(which is a register related to TakeDamage function)

So what's the problem? Why would the main function refuse to calculate new value depending on enemy ator distance from impact point?

enter image description here


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images