BindAction issue

Hello Again :slight_smile:

I am trying to bind the space bar to a boost action. This should temporilty double the speed of the player when the space bar button is pressed.

I used what I thought was the same logic and updated the input in the unreal editor. I test the functionality of my boost by adding it to the fire action and it worked fine so I have found the issue lies with triggering and calling the binded action.

void APawnTank::SetupPlayerInputComponent(UInputComponent *PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);
    PlayerInputComponent->BindAxis("MoveForward", this, &APawnTank::CalculateMoveInput);
    PlayerInputComponent->BindAxis("Turn", this, &APawnTank::CalculateRotateInput);
    PlayerInputComponent->BindAction("Fire",IE_Pressed,this,&APawnTank::Fire);
    PlayerInputComponent->BindAction("Boost",IE_Pressed,this,&APawnTank::Boost);
    PlayerInputComponent->BindAction("Boost",IE_Released,this,&APawnTank::RemoveBoost);
}

void APawnTank::Boost() 
{
    MoveSpeed = MoveSpeed + BoostSpeed;
    UE_LOG(LogTemp,Warning,TEXT("Boost Activated Successfully MoveSpeed is : %f"),MoveSpeed);
}

void APawnTank::RemoveBoost() 
{
    MoveSpeed = DefaultMoveSpeed;
}

image

Any Idea what I am missing / doing wrong here?

I see why now I put the Boost in the Axis Section rather then the ACTIONS SECTION!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms