x

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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

[4.7.5] Cannot process input events of additional gamepads anymore

I used to be able to process input events of all attached input devices by deriving from UGameViewportClient and overriding methods such as InputKey(). If a user pressed "Start" on an attached gamepad I would create a player for that user for local coop gameplay.

Since 4.7 it seems events are already being filtered within the Slate Application class and are not passed to the Game Viewport Client.

So how can I get hold of input events of devices not yet being assigned to a player?

Marc

Product Version: Not Selected
Tags:
more ▼

asked Apr 27 '15 at 09:23 AM in Bug Reports

avatar image

mkamradt
294 15 136 34

avatar image mkamradt Apr 27 '15 at 12:24 PM

I am using a different approach now but that has its shortcomings, too:

I subclassed the Analog Cursor that gets all events beforehand. But within the HandleKeyUpEvent method I am having a hard time creating a new player. For one thing there is no access to any "world" or "worldcontextobject". I am now setting a World pointer from the outside every frame which is ugly. For another thing I need a "controller id" to create a player. However the InKeyEvent only provides a "user index". There are no global conversion functions available. I am using the user index as the controller id for now because in UE 4.7 they are always the same but is probably going to change in the future - according to source code comments...

So what is the correct / intended way to handle this use case?

Marc

avatar image Doug E ♦♦ STAFF Apr 27 '15 at 05:40 PM

Hey mkamradt-

Just so I understand, is the problem that multiple gamepads don't receive any of your input commands? If so does the first player gamepad receive input? Could you post the code that you use that used to work as well as the code you have now?

Cheers

Doug Wilson

avatar image mkamradt Apr 28 '15 at 10:43 AM

Hey Doug,

Maybe this explains it better:

What I want to achieve:

• Two gamepads are connected to the PC / Console • Player One is created by default, is connected to gamepad one and can use the menu and start gameplay • Another user can press “Start” on the second gamepad to create Player Two to join for local coop

The basic problem:

• Input events (such as “Press Start”) are not routed to UMG or other easily available global objects if the gamepad is not associated with an already created player

Technically this was possible in 4.6 using the following method:

• Subclass UGameViewportClient and override methods such as InputKey() • UGameViewportClient gets all input events from all input devices regardless of created players • If “Start” is pressed, create a new player for that controller • All necessary data is available (World Context, Controller Id)

For 4.7 the input events are not routed to UGameViewportClient anymore, so the only work-around I found so far is this:

• Subclass IInputProcessor / FAnalogCursor and override methods such as HandleKeyDownEvent() • IInputProcessor gets all input events from all input devices regardless of created players • If “Start” is pressed, create a new player for that controller • However the World (or World Context Object) in not available at that time and neither is the Controller Id • The input event holds a “User Index” that relates to a Controller Id however there are no function convert back and forth between them

Marc

avatar image Vector Apr 20 '16 at 09:26 PM

Hi,

I have the same problem in 4.10

Did any one found solution?

Thanks

avatar image mkamradt Apr 21 '16 at 07:51 AM

The solution I mentioned is still valid: Subclass IInputProcessor, give it a pointer to the world, override the input related methods, create a player if "start" or whatever is pressed. I used this technique in a 4.8 and a 4.10 based project.

Marc

avatar image Vector Apr 21 '16 at 07:52 PM

Than you mkamradt

I just was wondering if any other solution aper seance 4.7, but I didn't noticed it.

I will try your way then

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

1 answer: sort voted first

Hey mkamradt-

I've entered a feature request to include input from a device without the creating the character (UE-14833). This would make it easier for multiple player to join a game already in session.

Cheers

Doug Wilson

more ▼

answered May 01 '15 at 04:17 PM

(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