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)