spencer-melnick / Threshold

Untitled Unreal Engine project
Other
6 stars 2 forks source link

Input fixes #35

Closed spencer-melnick closed 3 years ago

spencer-melnick commented 3 years ago

Right now, the input system is a little janky - enabling and disabling input doesn't seem to work all that well, particularly in context of the new menu UI.

After a little bit of digging in the engine source, it turns out that the standard input system actually uses a stack of input components, and that enabling and disabling an input component removes it from the player stack. Furthermore, all actors have the ability to create their own input components (whenever EnableInputComponent is called on the actor, it will create an input component if one does not exist yet).

For these fixes I'd like to split up input into several components, one for each logical group that can be enabled or disabled as the player switches control modes.

The main player controller would always have its input enabled, so that it can switch modes, but the character input component, for instance, would be disabled when the player opens a menu, and vice versa.

It might also be nice to put camera controls into an input component for the player camera manager, but that could possibly be done in #12

spencer-melnick commented 3 years ago

Pretty much done! The player menu has its own input component, the pawn has one, and the player controller has another. The player controller listens for a toggle input (right now its "I" on keyboard and start on controller), and switches between enabling the others.

Since I moved the character controls out into the player pawn, I got rid of the targeting controls for now, but they shouldn't be too difficult to migrate.