Add ability to simulate VirtualInput activation#693
Open
fuzzypixelz wants to merge 1 commit intoprime31:masterfrom
Open
Add ability to simulate VirtualInput activation#693fuzzypixelz wants to merge 1 commit intoprime31:masterfrom
fuzzypixelz wants to merge 1 commit intoprime31:masterfrom
Conversation
Collaborator
|
Why not just subclass a custom Node? you could implement the same functionality. |
Owner
|
Yeah, @redthing1 may be right on this one. Now that I see the code it’s a bit more intrusive than my initial thoughts about it ;) Maybe instead swap to a subclass for each: SimulatedVirtualAxis, SimulatedVirtualButton, etc. |
Collaborator
|
Ya, I did exactly this in my project. If you want the code let me know, but it's pretty simple and straightforward to implement yourself. |
Author
|
I guessed as much because to be honest I wasn't satisfied with it myself. |
Collaborator
|
Very very simple, here's my virtual joystick: |
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.
This changes the four VirtualInput classes to include a
Simulate(...)method that allows (you guessed it) simulating an input.The implementation uses the
Update()method to keep the input activated for one frame, with the help of asimulationStepcounter.This may be pretty hacky, so I'm open to reimplementing it in a cleaner way if the maintainers so desire.