Closed
Conversation
Contributor
Author
|
A quick and dirty change to add input consesus is here: - input.movement = Vec3::new(move_vec.x, vertical_axis, move_vec.y);
+ input.movement += Vec3::new(move_vec.x, vertical_axis, move_vec.y);
^
- input.sprint = button_input.pressed(button(controller.pad_sprint));
+ input.sprint = input.sprint || button_input.pressed(button(controller.pad_sprint));
^-------------^
- input.jump = button_input.pressed(button(controller.pad_jump));
+ input.jump = input.jump || button_input.pressed(button(controller.pad_jump));
^-----------^
- input.fly = button_input.just_pressed(button(controller.pad_fly));
+ input.fly = input.fly || button_input.just_pressed(button(controller.pad_fly));
^----------^
- input.crouch = button_input.pressed(button(controller.pad_crouch));
+ input.crouch = input.crouch || button_input.pressed(button(controller.pad_crouch));
^-------------^This naive implementation is kinda brittle as relies on the gamepad input running after the keyboard input, but it does work. |
Contributor
Author
|
After asking around online, someone brought up a good point in favour of the input consensus solution.
As such, I think the consensus solution would be the way to go. |
3ec7297 to
e50eed7
Compare
It is now possible to use keyboard/mouse/gamepad in tandem. Also, FpsControllerInput is now stateless and truly represents one frame of input.
e50eed7 to
9ab020a
Compare
Owner
|
Hey, thank you for the PR! Closing for the same reason mentioned here: #48 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The controller doesn't currently support gamepads. This PR aims to change that!
Currently, keyboard input is broken as the gamepad is overriding the values in
FpsControllerInput.There are two ways of solving this:
I'm not sure which solution is best, so any input is welcome! (pun not intended)