Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Bind key input to ActorComponent function?

Is it possible somehow to bind a Input key event to a function in my custom ActorComponent?

Something like this: InputComponent->BindAction("MoveForward", IE_Released, this,&UMyActorComponent::Something);

Product Version: Not Selected
more ▼

asked Nov 28 '14 at 08:10 PM in C++ Programming

avatar image

89 19 26 31

avatar image eXi Nov 28 '14 at 11:49 PM

As far as i know, the "SetPlayerInputComponent" function is only available inside the APawn, ACharacter and ADefaultPawn classes. I'm not that skilled in c++ so i can't say if it is possible or not to bind this (maybe just test it? :D).

But what about binding a normal function to it, like you would do normaly and just call "Something" inside this bound function? Would that be a workaround?

avatar image Eqric Nov 29 '14 at 09:36 AM

I guess it is but it doesn't look good :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You should be able to from a purely C++ standpoint. I don't know how the BindAction function will react to it though. The pointer you will have to pass on is a pointer to the component instead of the this pointer. Alternatively, you should be able to make a delegate out of any function and use the bindaction with that delegate.

more ▼

answered Nov 30 '14 at 02:31 PM

avatar image

664 21 18 177

avatar image Eqric Nov 30 '14 at 10:51 PM

I guess the way to go is with delegates. Thanks for the input!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question