X Tutup
Skip to content

Adding "relative mode" to OnScreenStick#658

Closed
eblabs wants to merge 3 commits intoUnity-Technologies:stablefrom
eblabs:Relative-Mode-option-for-Virtual-Joystick
Closed

Adding "relative mode" to OnScreenStick#658
eblabs wants to merge 3 commits intoUnity-Technologies:stablefrom
eblabs:Relative-Mode-option-for-Virtual-Joystick

Conversation

@eblabs
Copy link

@eblabs eblabs commented Jun 3, 2019

Hi,
Currently, the OnScreenStick controller uses your first touch to determine a "start point". In many cases it's actually more helpful to always have the "start point" at the center of the joystick.
Scenario, if I tap right on the controller, currently this would not register any movement because the origin of the movement is reset to this point. Ideally if I tap right, I would expect the controller to register this tap as being on the right side of the controller not at zero.
I think this should be the default behaviour, please let me know your thoughts.
Thanks!!

eblabs added 2 commits June 3, 2019 10:59
Currently, the controller uses your first touch to determine a "start point". In many cases its actually helpful to always have the "start point" at the center. 
Scenario, if I tap right on the controller, currently this would not register any movement because the origin of the movement is reset to this point. Ideally if I tap right, I would expect the controller to register this movement.
@jechter
Copy link

jechter commented Jun 5, 2019

Conceptually, seems right. I guess I don't know what common usage expectation for on screen sticks are, but I think it makes sense to add this option.

Would be good to have a test for this in Assets/Tests/InputSystem/Plugins/OnScreenTests.cs, though - and we need to run the code formatter script on this before landing, I don't think the indentation on this would pass CI.

@eblabs
Copy link
Author

eblabs commented Jun 5, 2019

Thanks for your feedback @jechter.

Would you mind clarifying your comments on the formatting/indentation issues? Id be happy to make any needed changes.

Cheers,

Eric

@jechter
Copy link

jechter commented Jun 6, 2019

Don't bother with the formatting. We can fix that for you, when we land it. (We have automated formatting tools, and PRs will fail if they are not run, but I don't think this stuff is publicly available atm).

@eblabs
Copy link
Author

eblabs commented Jun 6, 2019

Great, thanks @jechter. I'll leave this as is then...

Cheers,

Eric

@jechter
Copy link

jechter commented Jun 6, 2019

Great, thanks @jechter. I'll leave this as is then...

It would still be great to add a test in Assets/Tests/InputSystem/Plugins/OnScreenTests.cs, though.

@eblabs
Copy link
Author

eblabs commented Jun 8, 2019

Hey @jechter, I'm not familiar with how your unit testing works. So I'll leave that up to you then.
Thanks!!

@unity-cla-assistant
Copy link

unity-cla-assistant commented Jun 3, 2021

CLA assistant check
All committers have signed the CLA.

@eblabs
Copy link
Author

eblabs commented Jun 3, 2021

Hi @jechter,
I just resolved a conflict on my code, but of course please check it out when you have a chance.
Thanks!
Eric

@jamesmcgill
Copy link
Collaborator

Thank you for the PR.
We have taken your suggestion on board and will add this feature. We have an internal PR with this change here: #1613

Needle-Mirror-Bot pushed a commit to needle-mirror/com.unity.inputsystem that referenced this pull request Jan 25, 2023
## [1.5.0] - 2023-01-24

### Added
- Added support for reading Tracking State in [TrackedPoseDriver](xref:UnityEngine.InputSystem.XR.TrackedPoseDriver) to constrain whether the input pose is applied to the Transform. This should be used when the device supports valid flags for the position and rotation values, which is the case for XR poses.
- Added `InputSettings.shortcutKeysConsumeInput`. This allows programmatic access to opt-in to the enhanced shortcut key behaviour ([case ISXB-254](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-254))).
- Significantly optimized cost of `ReadValue`/`ReadUnprocessedValueFromState`/`WriteValueIntoState` for some control types. Optimization is opt-in for now, please call `InputSystem.settings.SetInternalFeatureFlag("USE_OPTIMIZED_CONTROLS", true);` in your project to enable it. You can observe which controls are optimized by looking at new optimized column in device debugger. You will need to call a new `InputControl.ApplyParameterChanges()` method if the code is changing `AxisControl` fields after initial setup is done.
- Added the ability to change the origin positioning and movement behaviour of the OnScreenStick (`OnScreenStick.cs`) via the new `behaviour` property. This currently supports three modes of operation, two of which are new in addition to the previous behaviour. Based on the user contribution from [eblabs](https://github.com/eblabs) in [#658](Unity-Technologies/InputSystem#658).
- Significantly optimized cost of `InputAction.ReadValue` and `InputControl.ReadValue` calls by introducing caching behaviour to input controls. Input controls now keep track of whether their underlying state has been changed and only read the value from the underlying state and apply processors when absolutely necessary. Optimization is opt-in for now, please call `InputSystem.settings.SetInternalFeatureFlag("USE_READ_VALUE_CACHING", true);` in your project to enable it. If there are issues try enabling `InputSystem.settings.SetInternalFeatureFlag("PARANOID_READ_VALUE_CACHING_CHECKS", true);` and check in the console if there are any errors regarding caching.
- Added a note in the [supported devices page](Documentation~/SupportedDevices.md) about DualSense support for Android devices.
- Exposed `displayIndex` property for `Pointer`, `Touchscreen`, `TouchControl`, `TouchState`, `Mouse`, `MouseState` which enables look up of the logical screen associated with a pointer event via (display documentation)[https://docs.unity3d.com/ScriptReference/Display.html]

### Fixed
- Fixed composite bindings incorrectly getting a control scheme assigned when pasting into input asset editor with a control scheme selected.
- Fixed an issue on PS5 where device disconnected events that happen while the app is in the background are missed causing orphaned devices to hang around forever and exceptions when the same device is added again ([case UUM-7842](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-6744)).
- Fixed Switch Pro, DualShock 4, DualSense gamepads becoming current on PC/macOS when no controls are changing ([case ISXB-223](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-223))).
- Fixed an issue that made OnScreenStick unusable when used in conjunction with PlayerInput in Auto-Switch devices mode, or with any code that changes user/device pairing on unsued device activity being detected ([case ISXB-48](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-48)).
- Fixed issue where input events were being suppressed during interactive action rebinding even when when their controls were excluded ([case ISXB-367](https://issuetracker.unity3d.com/issues/mouse-position-and-mouse-click-input-not-recognized-when-rebinding-is-active)).
- Removed unneeded check that could trigger a NotImplementedException when binding to a Usage (e.g. Submit) ([case ISXB-373](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-373)).
- Display a warning instead of throwing a NotImplementedException when loading binding overrides from json when some of the entries have become outdated ([case ISXB-375](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-375)).

### Actions
- Extended input action code generator (`InputActionCodeGenerator.cs`) to support optional registration and unregistration of callbacks for multiple callback instances via `AddCallbacks(...)` and `RemoveCallbacks(...)` part of the generated code. Contribution by [Ramobo](https://github.com/Ramobo) in [#889](Unity-Technologies/InputSystem#889).

### Changed
- Changed define requirements of `Unity.InputSystem.TestFramework`, so that it can be used by other packages without setting the `com.unity.inputsystem` package to be testable in the project manifest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup