Announcement

Collapse
No announcement yet.

Input component calling functions from another class.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Input component calling functions from another class.

    Hey all, I am looking for some clarity on the following code:

    Code:
    InputComponent->BindAction("FirePrimary", IE_Pressed, PlayerPawn, &AShipPlayerController::FirePrimary);
     InputComponent->BindAction("FireSecondary", IE_Pressed, PlayerPawn, &APlayerShip::FireSecondary);
    
    
    void AShipPlayerController::FirePrimary()
    {
     //UE_LOG(LogTemp, Warning, TEXT("FirePrimary Called from player controller"));
     PlayerPawn->FirePrimary();
    }
    What I want to know is.. is there a way to cut out the member functions in the player controller and just call the function from the player controller straight to the player pawn.
    I have tried :
    Code:
     InputComponent->BindAction("FirePrimary", IE_Pressed, PlayerPawn, PlayerPawn->FirePrimary);
    or variants of.
    where playerpawn is a reference to the possessed pawn.

    Bascially I want to not have to call 2 functions for one input read. Thanks in advance !

Working...
X