# AddForce to this pawn

**URL:** <https://forums.unrealengine.com/t/addforce-to-this-pawn/347014>\
**Category:** World Creation\
**Tags:** force, addforce, unreal-engine, velocity, UE4, CPP, question\
**Created:** [February 10, 2016, 3:08pm UTC](https://forums.unrealengine.com/t/addforce-to-this-pawn/347014 "2016-02-10T15:08:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moynzy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Moynzy](https://forums.unrealengine.com/u/Moynzy)\
**Post date:** [February 10, 2016, 3:08pm UTC](https://forums.unrealengine.com/t/addforce-to-this-pawn/347014/1 "2016-02-10T15:08:12Z")

</div>

Hello,

```
	InputComponent->BindAxis("Forward", this, &AMyPawnHover::MoveActor);
	InputComponent->BindAxis("Turn", this, &AMyPawnHover::TurnActor);

```

In those two functions i calculate the current thrust and current turn.

With those obtained, I want to add this to the Pawn class.

For example, I want to refer to the this pawn. So in C# how you refer to the object, this.x = 10;

or in this can, this. Addforce(new Vector 3…)

```
// Called every frame
void AMyPawnHover::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	//Forward
	//happens over time, not a burst
	if (FMath::Abs(m_curThrust) > 0)
	{
		//vector 3 ForwardForce = this.transform.forward. * m_curThrust * Deltatime * this.mass
		//this.rigidbody.AddForce (ForwardForce) 
	}

}

```

In this update function the vehicle will move depending on the forward force,

I just need to know how to use the access this pawns “AddForce” method.

Thank you.

=========UPDATE===========

```
		FVector myActorForwardVector = GetActorForwardVector();
		FVector ForwardForce = myActorForwardVector * m_curThrust * DeltaTime;

```

I retrieve the force, but now I need the actors mass and

this.actor-\>AddForce(ForwardForce)

---

<div class="post-metadata">

**Author:** ![lion032](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lion032](https://forums.unrealengine.com/u/lion032)\
**Post date:** [February 11, 2016, 12:28pm UTC](https://forums.unrealengine.com/t/addforce-to-this-pawn/347014/2 "2016-02-11T12:28:55Z")

</div>

Do you use some kind of movement component?  
If you do then check if that movement component has support for control using forces e.g.  
in CharacterMovementComponent you have

```
virtual void AddImpulse(FVector Impulse,bool bVelocityChange)
virtual void AddForce(FVector Force)

```

If you don’t you and you set the root component to simulate physics then:

```
 void AMyPawnHover::Tick(float DeltaTime)
 {
     Super::Tick(DeltaTime);
 
     //Forward
     //happens over time, not a burst
     if (FMath::Abs(m_curThrust) > 0)
     {
         FVector myActorForwardVector = GetActorForwardVector();
         FVector ForwardForce = myActorForwardVector * m_curThrust * DeltaTime;
         if(RootComponent && RootComponent->IsAnySimulatingPhysics())//Check if root component is valid
         {
              RootComponent->AddForce(ForwardForce);
         }
     }
 
 }
```

---

<div class="post-metadata">

**Author:** ![Moynzy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Moynzy](https://forums.unrealengine.com/u/Moynzy)\
**Post date:** [March 9, 2016, 6:36pm UTC](https://forums.unrealengine.com/t/addforce-to-this-pawn/347014/3 "2016-03-09T18:36:44Z")

</div>

@lion32 can you help me please?
