Radial Force doesn't work at all?

I didn’t know radial damage even had a falloff value. I thought it was just a sphere detection area in which it checks for actors that can take damage and applies it.

Even still I dont see how that snippet of code would apply such a thing so still a little confused as to what you’re implying with the code.

Well if his radial damage is working thats great… as I may remind you in my version this function works too but it is very buggy due to an unknown reason, where it SEEMINGLY only works when a sweet spot is hit. I think if you download my repo all thats needed was the starter pack content to work.

But more concerning in this instance was the fact that radial impulse doesn’t add an impulse to actors around it. I suggest reading my original posts if you havn’t.

Well I guess its bedtime for Dan in England :stuck_out_tongue: its nearly 6 Pm there :blush: :stuck_out_tongue:

Because Super::TakeDamage would call APawn::TakeDamage and looking at the source code that mainly just checks if the Pawn can be damaged and calls AActor::TakeDamage if it can and which has a condition checking if the DamageEvent is point or radial and does the calculation if and it returns the result of those.

Was actually dinner time :stuck_out_tongue: Will go take a look at yours now.

I gathered as TL;DR this is a unique issue for @Steve1222, and while I have a functional radial damage application I think the ApplyRadialImpulse() method is flawed, even for me. Also, using Super:: is probably always a good idea, since it does a variety of things that we wouldn’t want to put in our own overrides.

Ugh I wish it was bed time here I was actually up all night again. :tired_face:
I assumed your take damage was set to sleep because you always seem to disappear around the hours of 6-8 in England lol…

Err I mean, well actually I don’t know what I mean cuz I still dont get what this event has to do with anything lol.
Radial Damage is still not working properly. (at least for me)
And Radial Impulse is not working at all,

… soo Balls … , yeah.

Because who wants to work those hours :stuck_out_tongue:

Haven’t tested impulses at all so I’m not sure on that. And for some reason compiling is take several minutes after each minor change I make so debugging is going slowly.

1 Like

It does help after all to know why it was bugged even though i finished this course last month.

Will probably be working on AI again at some point soon after I finish Mike’s 3d modeling course.

Oh damn time must slow down when you’re being relatively productive. It was just over a couple weeks ago I actually finished this course xD

Was working on the wrong project -.-"

Though on yours what’s the problem with it. Don’t really see the problem apart from radial impulse only really working like a point impulse.

Thats because it is a point impulse. Its a work around. If you read this thread from the start you see the problem. Then you see how I tried to debug and work around it.

Fire Impulse didn’t work from code and I tried to debug it by doing it in blueprints.

In blueprints nothing worked but the add impulse at location. This thread is from last month.

Aplogies, forget there was a thread in here…
Well radial damage works with this

LaunchBlast->Deactivate();
ImpactBlast->Activate();
ExplosionForce->FireImpulse();

SetRootComponent(ImpactBlast);
CollisionMesh->DestroyComponent();
UGameplayStatics::ApplyRadialDamage(
	this,
	ProjectileDamage,
	GetActorLocation(),
	ExplosionForce->Radius, // for consistancy
	UDamageType::StaticClass(),
	TArray<AActor*>() // damage all actors
);
FTimerHandle Timer;
GetWorld()->GetTimerManager().SetTimer(Timer, this, &AProjectile::OnTimerExpire, DestroyDelay, false);

I tried the impulse with this, but compiling seems to be never ending so can’t test it.

if (OtherActor)
{
	UStaticMeshComponent* Root = Cast<UStaticMeshComponent>(OtherActor->GetRootComponent());
	Root->AddRadialForce(Hit.Location, ExplosionForce->Radius, 1000.f, ERadialImpulseFalloff::RIF_Constant);
}

Though thinking about it I’m doubting it would work, as it hasn’t hit OtherActor in the case of hitting the ground next to it. Would need to do that in TakeDamage instead. Though I don’t know where it would get the hit location within that. :confused:

Hmm, well I’m not sure where the if(OtherActor){} part is, since I’d have to brush up on this code,
but it looks like you’re using some kind of AddRadialForce function, instead of creating a radial force component?

Not sure if I tested this before, but when I use it now in blueprint, I do get some kind of force being applied SOMETIMES.


^And when i add a for loop to it, the force is much more evident, despite not working all the time.
(compativly as evident as when adding a delay between loops)
This is ofcourse a bit different then the impulse which is why I tried adding a for loop.
The old add impulse however works every time.
This add radial force seems to work … rarely.

So its come to me now that maybe this random decision to work or not. Maybe the cause of why it works or not is an area of suspicion?
At least in terms of the impulse working in general. Not entirely sure with the radial force component.

I’ll look forward to this thread. I’ll push for now since I believe I’m satisfied with my results.

Anyhow if this tends to be a bug send this over to the devs will ya?

I was suggesting to add that to that function. However I have now realised your projectile blueprint doesn’t have your C++ code in it…
Edit: Nevermind, for some reason I have your project twice and was coding in one and editing in the other …

Ugh little things like that happen all the time and we never learn from them, lol. Cuz its an easily repeatable error practically a design flaw of windows even in combination with the way the mind works to not notice you have two projects open. I mean what are you gonna try to edit your work flow to open specific programs and make your you have one open every time? lol. or change the way windows works?
-though that wouldn’t be a bad idea. Let’s change the way windows works.\

-Lets make a new OS that is command only based. (typed commands)

Actually I’m not sure if that for loop was even working as expected. Because I’m having trouble replicating radial force behavior today. It might be because the projectile is being destroyed before it can loop again. Either that or its because it needs to progress to the next frame to update the force at all. - not sure how the loops work in blueprint.

One way or another very temperamental behavior from radial force… Let alone radial impulse.
Edit: OMG I just tried changing back to radial impulse. And i’m getting a force applied SOMETIMES. But these forces are hard to replicate cuz theyre tempormental in general. So its hard to notice its working at all 90 percent of the time.

Its hard to get a decent screenshot of my take being blown back because its so rare:


But it does happen sometimes.

I’ve removed all blueprint code and after re-arranging the timer to be the last thing in the function elevated things with only a certain distance not achieving damage (which I would now suspect it was mainly the angle of in which the projectile was in when it hit something due to how your projectile is stretched), then I suspected that it’s the collision mesh interferring with things. So now

void ATank_Projectile::OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit) 
{
	UE_LOG(LogTemp, Error, TEXT("%s hit"), *GetName())
	SetRootComponent(ImpactBlast);
	CollisionMesh->DestroyComponent();
	LaunchBlast->Deactivate();
	ImpactBlast->Activate();
	ExplosionForce->FireImpulse();
	
	UGameplayStatics::ApplyRadialDamage(this, TankDamage, GetActorLocation(), ExplosionForce->Radius, UDamageType::StaticClass(), TArray<AActor*>());
	FTimerHandle TimerHandle;
	GetWorld()->GetTimerManager().SetTimer(TimerHandle, this, &ATank_Projectile::DestroyProjectile, DestroyDelay, false);

}

Works except for the impulse doing nothing. You aren’t simulating physics on the tank body.

What about attaching a static mesh to the root like this?
projectile%20static%20mesh

Privacy & Terms