# How can I add radial force to actor which uses UProjectileMovementComponent?

**URL:** <https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600>\
**Category:** World Creation\
**Tags:** projectilemovement, radial-force, unreal-engine, Physics, question, CPP\
**Created:** [November 30, 2018, 8:04am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600 "2018-11-30T08:04:02Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_60e2a251](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_60e2a251](https://forums.unrealengine.com/u/anonymous_user_60e2a251)\
**Post date:** [November 30, 2018, 8:04am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/1 "2018-11-30T08:04:02Z")

</div>

Hello, This is my first time posting in this forum so please go easy on me.

I’m making a game which has a bouncing ball in it, I’ve achieved the bounce effect of the ball using the `UProjectileMovementComponent` now I want to add radial force on the ball when it overlaps my `Vacuum`.

when I try to use `MyProjectile->MyProjectileMovementComponent->AddRadialForce()` It does nothing… I’ve been digging around the source and found out that the default implementation of `UMovementComponent::AddRadialForce()` does nothing as shown here.

 ![260949-question.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/9/58976d09a790447ebad0db6fe8fd63238a36431c.png)

And I can’t use `MyProjectile->MyRootComponent->AddRadialForce()` because my projectile is not simulating physics…

Is there a way to add radial force to an actor which uses `UProjectileMovementComponent` ?

Or should I code my own `AddRadialForce()` function?

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [November 30, 2018, 5:10pm UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/2 "2018-11-30T17:10:23Z")

</div>

Hi. Place radial force component in your Vacuum Actor, set Radius and Impulse Strength strong enough to have an influence on your ball actor. and handle overlap event with radial force component - fire impulse function call !

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_60e2a251](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_60e2a251](https://forums.unrealengine.com/u/anonymous_user_60e2a251)\
**Post date:** [November 30, 2018, 6:38pm UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/3 "2018-11-30T18:38:49Z")

</div>

Hello, Thank you for responding.  
I’ve tried this but nothing happened… And to be sure, I’ve placed a ball simulating physics next to my bouncing ball and your solution worked for it but did not affect my bouncing ball.  
I am thinking of creating a custom component inherited from `UProjectileMovementComponent` and override the `AddRadialForce()` then, When I call the function I’ll get the `Vacuum` location and use it as the origin of the force. I hope this will work…  
If you have any other ideas please comment them down

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [November 30, 2018, 6:47pm UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/4 "2018-11-30T18:47:27Z")

</div>

add more force and try again and it will work . sorry can answer only tomorrow

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_60e2a251](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_60e2a251](https://forums.unrealengine.com/u/anonymous_user_60e2a251)\
**Post date:** [November 30, 2018, 6:49pm UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/5 "2018-11-30T18:49:52Z")

</div>

It’s okay.  
I’ve tried it but still, nothing…

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [December 1, 2018, 6:11am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/6 "2018-12-01T06:11:57Z")

</div>

void ABlackHole::Tick(float DeltaSeconds)  
{  
Super::Tick(DeltaSeconds);

```
	TArray<UPrimitiveComponent*> Components;
	AttractiveSphere->GetOverlappingComponents(Components);
	for (UPrimitiveComponent* Component : Components)
	{
		if (Component && Component->IsSimulatingPhysics())
		{
			FVector DirectionToAttract = GetActorLocation() - Component->GetComponentLocation();
			FVector Force = DirectionToAttract * ForceStrength;
			Component->AddForce(Force);

			/** REPLACE TO HEADER */
			/* attractive sphere */
			// UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
			// class USphereComponent* AttractiveSphere;

			/** the force strength to attract physics objects */
			// UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Config", meta = (AllowPrivateAccess = "true"))
			// float ForceStrength = 2500.f;

		}
	}
}
```

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [December 1, 2018, 6:13am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/7 "2018-12-01T06:13:20Z")

</div>

> **[blueprintUE | PasteBin For Unreal Engine 4](https://blueprintue.com/)**
>
> blueprintUE is a tool for sharing, rendering and rating blueprints for Unreal Engine 4. UE4 is a game engine which use visual scripting called blueprint.

BP version of black hole with radial force component

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [December 1, 2018, 6:17am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/8 "2018-12-01T06:17:37Z")

</div>

I don’t know what is “a bouncing ball” is a thing in your project, but to use my way it needs something that simulates physics to work. For instance, static mesh component of bouncing ball actor…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_60e2a251](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_60e2a251](https://forums.unrealengine.com/u/anonymous_user_60e2a251)\
**Post date:** [December 1, 2018, 10:05am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/9 "2018-12-01T10:05:15Z")

</div>

Hello, Thank you for your anwser.  
The scenario I want to achieve is to make my ball get effected by the radial force of the vacuum.  
Look, What is the main problem is that my `Projectile` is not simulating physics… In your answer here you made a check whether if the overlapping component is simulating physics or not `if (Component && Component->IsSimulatingPhysics())`. Here the problem is that the`UProjetileMovementComponent` replace the root component & will only take affect if the replaced component is not simulating physics (Hence So it will never execute this if block) and it is a collision component. Furthermore, if the replaced component is simulating physics then it will only take affect **Once** “From when the `Projectile` is spawned, till the first event occurs which needs physics to operate on”.  
For example: " If I lunched the ‘simulating physics projectile’ by changing the velocity of the `UProjectileMovementComponent` it will move using `UProjectileMovementComponent` but when it hit something the `UProjectileMovementComponent` is deactivated and the physics take place from there" And when this happens, the `Projectile` will no longer bounce…

- I see what you are trying to say,

1. If I make the `StaticMesh` as child and enable its physics so it will be effected by the force.Well It will But, the only thing will be effected is the `StaticMesh` and not the root.  
This is a problem because the `StaticMesh` will be moved while the replaced component (RootComponent) will stay at the same position.

2. If I set the updated component to the mesh and disable its physics then enable the root’s component physics… It will be absorbed but wont bounce cause the `UProjectileMovementComponent` only works on collision component…

If I have any wrong knowledge please correct me.  
Thanx in advance.

```
ThunderButt.

```

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [December 1, 2018, 10:43am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/10 "2018-12-01T10:43:48Z")

</div>

I made some tryes by myself and its seems to physics and projectile movement component isn’t compatible. Engine force us to use only one thing at the same time… You can dive deep in this direction. But I have some idea to force your vacuum works and it will be very simple solution. You can try something like this. Make a USphereComponent for Vacuum actor (it will be vacuum influence border). Whenever your bouncing ball overlaps this sphere collider Mark your projectile movement component as Homing Projectile and set Homing Target component to the root component of the Vacuum actor (also set Homing acceleration magnitude to sensible default value)

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [December 1, 2018, 10:45am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/11 "2018-12-01T10:45:23Z")

</div>

and reverse it back whenever vacuum intended to stop working according to your game mechanic

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [December 1, 2018, 10:48am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/12 "2018-12-01T10:48:38Z")

</div>

> **[blueprintUE | PasteBin For Unreal Engine 4](https://blueprintue.com/)**
>
> blueprintUE is a tool for sharing, rendering and rating blueprints for Unreal Engine 4. UE4 is a game engine which use visual scripting called blueprint.

---

<div class="post-metadata">

**Author:** ![NoCodeBugsFree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoCodeBugsFree](https://forums.unrealengine.com/u/NoCodeBugsFree)\
**Post date:** [December 1, 2018, 10:49am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/13 "2018-12-01T10:49:14Z")

</div>

sphere collision is root of vacuum

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_60e2a251](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_60e2a251](https://forums.unrealengine.com/u/anonymous_user_60e2a251)\
**Post date:** [December 1, 2018, 11:04am UTC](https://forums.unrealengine.com/t/how-can-i-add-radial-force-to-actor-which-uses-uprojectilemovementcomponent/438600/14 "2018-12-01T11:04:47Z")

</div>

Hey, Thank you it worked! I really appreciate it.

It didn’t have the same effect I was looking for but I think I can live with that 🙂
