Announcement

Collapse
No announcement yet.

Cannot check if a certain key is down

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

  • replied
    Did the answer to your question on the answer HUB not resolve this?

    https://answers.unrealengine.com/que...is-updown.html

    Leave a comment:


  • replied
    Without seeing the code in context, I'm unsure what is going on

    Leave a comment:


  • replied
    well thats the class hierarchy right there....

    Leave a comment:


  • replied
    Actor => Pawn => Character => YourCharacter?

    Code:
    void AYourCharacter::Tick()
    {
        ...
    As long as your actor/pawn/character has a controller that is also a player controller, using the PC->InputKeyDown() should work.
    If not, nada.

    Leave a comment:


  • replied
    I have the UInputComponent I receive at the SetupPlayerInputComponent override for my class which inherits from ACharacter.
    That being so, the Tick function is from an Actor, since Character inherits from it.

    Leave a comment:


  • replied
    An input component itself does nothing unless it is enabled and added to the player input 'stack'.
    This gets processed by the player input class, which itself is called from the player controller.

    Check out: https://docs.unrealengine.com/latest...put/index.html

    So the question is, which tick function?
    Actor? Pawn? PlayerController? Other?

    For example, detecting the key input from a Pawn, you could do:
    Code:
    if (APlayerController* PC = Cast<APlayerController>(Controller))
    {
        if (PC->InputKeyDown(EKeys::A))
        {
            GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("This is an on screen message!"));
        }
    }

    Leave a comment:


  • started a topic Cannot check if a certain key is down

    Cannot check if a certain key is down

    Code:
    float result = InputComponent->GetAxisKeyValue(EKeys::A);
    if ( result){		
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("This is an on screen message!"));
    }
    I have that in my Tick function. The tick function actually gets called, but apparently there is something wrong with the above code. I tried other keys, but still nothing.
Working...
X