Closed markhaye closed 4 years ago
Interesting point. One issue is that would prevent you from having more than one analog control in a non-zero state at any given time. So, for example, you wouldn't be able to drive a tank-drive. There would have to be a way to specify whether you want to snap back vs. hold position. For example, maybe a double-click, or simultaneously pressing the right and left mouse buttons. I'll have to think about that.
Wow, I hadn't thought about that. Maybe a separate "reset" button? Thanks for taking a look!
Try this branch: snap_back.
Default behavior is control holds its position when released ("hold"). But, pressing shift key while manipulating the control puts it (transiently) in "snap back" mode, so when released it will snap to zero.
The default behavior can be changed from "hold" to "snap back" in the Config.java file by changing the value of HOLD_CONTROLS_BY_DEFAULT. Then, using the shift key would put it transiently in "hold" mode.
Adjustment to behavior of snap_back branch:
Config.HOLD_CONTROLS_BY_DEFAULT determines default behavior when an analog control is released. The default behavior is overridden by the opposite behavior if either ALT or SHIFT is down at the moment the control is released. So holding SHIFT or ALT down all the time would override the default behavior for all analog controls all the time. Or, SHIFT or ALT could be used selectively. Will test this more and merge with master if it doesn't cause problems.
Merged snap_back branch into master.
I updated my copy and tried it out. Fantastic. Works great. Thanks so much.
Firstly, thanks for creating this amazing project and I can't wait to use it more with my team.
Issue is that the joysticks and triggers on the virtual controller don't "snap back" to the neutral position when I release them. I have to manually move them back in order to get the robot/servos/whatever to stop moving. Would be nice if they behaved more like a real controller in this respect.
Anyway, minor issue on a great project.