About Radial Force Component

So we’ve got a Radial Force Component attached to an actor (that is an explosive like a grenade)

324428-radialimpulseexplosion.png

This component is actually affecting my Pawn when I’m calling Fire Impulse inside the same actor

All is working good as expected but this is affecting the actors through walls, if we want the impulse to only be triggered to the actors that are visible from the origin we just need to manually make that impulse without the Radial Force Component to the affected actors, filtered by the Damage Prevention Channel of the Apply Radial Damage node

The problem is that neither of Impulse, Radial Force or Damage Type is working on the Pawn like the Radial Force Component was…

And I have tried all nodes related on the pawn

At this point spawning a Radial Force Component will affect all the Pawns through walls. I must make the Radial Force Impulse manually affecting the pawns individually that are Affected only

I’m surely missing something here, why is the Radial Froce Component working on my pawn on the world but the Add Radial Force Nodes and Damage Type don’t ?

Hi! The thing is that MovementComponents often control its UpdatedComponent movement. In fact, the logic of Radial Force Component is like this:

PrimitiveComponent->AddRadialForce(Origin, Radius, ForceStrength, Falloff);

// see if this is a target for a movement component
AActor* ComponentOwner = PrimitiveComponent->GetOwner();
if(ComponentOwner)
{
	TInlineComponentArray<UMovementComponent*> MovementComponents;
	ComponentOwner->GetComponents<UMovementComponent>(MovementComponents);
	for(const auto& MovementComponent : MovementComponents)
	{
		if(MovementComponent->UpdatedComponent == PrimitiveComponent)
		{
			MovementComponent->AddRadialForce(Origin, Radius, ForceStrength, Falloff);
			break;
		}
	}
}

You can see, that it do two things:

  • call PrimitiveComponent->AddRadialForce(Origin, Radius, ForceStrength, Falloff) on affected Primitive component
  • call MovementComponent->AddRadialForce(Origin, Radius, ForceStrength, Falloff) on MovementComponent that controls this Primitive component;

Thank you for bringing this explanation!

So it’s basically adding the Radial Force to the Primitive Component and if it has a Movement Component it will apply it to it too, is that correct?

But it still doesn’t work when using the mesh or movement components while calling the “Add Radial Force” node in blueprint like this

While the Radial Force Component stills affecting the pawn, what I’m missing here?

Edit: Okay… I got it, it will search the movement component of the primitive component so there’s no need to reference it directly, the problem must be elsewhere then… But where?

You need to call some function on CharacterMovement. It will not work calling it on UpdatedPrimitive, because it is controlled by CharacterMovement. Also you cant simply call AddRadialForce(Origin, Radius, ForceStrength, Falloff) on CharacterMovement - it is not UFUNCTION. But you can use AddForce method of CharacterMovement. To do it you need only to calculate force by your side with this

FVector Delta = UpdatedComponent->GetComponentLocation() - Origin;
const float DeltaMagnitude = Delta.Size();

// Do nothing if outside radius
if(DeltaMagnitude > Radius)
{
	return;
}

Delta = Delta.GetSafeNormal();

float ForceMagnitude = Strength;
if (Falloff == RIF_Linear && Radius > 0.0f)
{
	ForceMagnitude *= (1.0f - (DeltaMagnitude / Radius));
}

AddForce(Delta * ForceMagnitude);

Yeas, that was what I was looking for !! But is not working :confused:

Even though it wont let me call AddRadialForce(Origin, Radius, ForceStrength, Falloff) on CharacterMovement directly, converting it automatically to Updated Primitive

But unfortunately applying Force through CharacterMovement is not working neither

That’s what I don’t get it… What else might be preventing this to work ?

Smth like that, but I dont add this part, that you may need

if (Falloff == RIF_Linear && Radius > 0.0f)
{
ForceMagnitude *= (1.0f - (DeltaMagnitude / Radius));
}

Thank you kindly Kehel18 for the effort and the formula (that I will surely use when I can get this to work!), but neither the nodes AddForce or AddRadialForce are affecting my Pawn like the Radial Force Component is

The Event is firing as expected but the AddForce does absolutely nothing on the Pawn and I have run out of ideas why

Hi! Just have checked that on 4.23, all is working. This approach was mentioned in prev picture, but this that I have today for testing. Also it can be because of Engine version…

Yes it could be the version, I’m gonna port a whole duplicate current project to the new 4.26 and see if it’s that, I will report back tomorrow if it’s working!

Good news it’s working now !! (And it was working this whole time…)

It just needed an absurd quantity of force to make a significant impulse that affects the pawn !

When putting 1000000,0 to the Force Strength it started to work !

If you could move this comments to the answer I will mark it, thanks again for the formula and your time, thank you kindly ^^ !!