Otherwise it'll use the first active device it finds after filtering them with IncludeDevices and ExcludeDevices. If you know it's only going to listen to a single device, you could just set actionSet.Device = inputDevice and that's the one it'll use because you've been explicit about it. but of course then you need to ask yourself all these questions and more. I could, and probably should, add something to the API where you can do something like actionSet.SetDefaultDeviceContext( InputDevice device ) and it'll just use what you tell it for better or worse. So, all this is to say, it gets extremely non-trivial to decide which names to use and when to update them, until the moment a device gives input. What happens if there were no devices at the time the bindings were added? What if the device you pick arbitrarily disconnects soon after? What if happens if another device connects? ![]() It gets trickier because you can change ( after you've added bindings) which devices the action set should include or exclude for listening. This is a frequent use case to separate game and menu input, for example. What if this is the second action set you're creating? Multiple input sets can listen to the same device. What if (1) was the broken controller? Note, InControl does not know when a controller is broken or non-responsive. And if you arbitrarily pick one, let's say the first one. Which control names should it use? It's ambiguous. Now, you make an action set and add some default bindings. A broken, unknown or non-responsive controller. So, for example, lets say you have 4 controllers attached:Ĥ. But before that, it has no idea which devices are relevant. Rebinding would cause that too since it's obvious the device that pressed the button is now active. I've tried to use the approach mentioned here, to look at the LastInputType on various PlayerActionSets, but there's a downside to that: it only fires when one of the specific PlayerActions in the PlayerActionSet is used.Ĭlick to expand.Technically, it updates the names as soon as a device is considered active (or the active device changes). This seems like a fairly complicated way to try to answer what seems like a fairly simple question: Is the player currently using Keyboard & Mouse, or are they using a Controller? I'm trying to find a reliable way to determine that. ![]() Just trying to answer the question of whether, at any given moment, the player is using the Mouse & Keyboard, or the Controller. And very often there are no player actions associated with mouse movement on Pause/Menu screens.Īnyway, I'm hoping I'm just missing something simple here. The LastInputType only works if the player happens to press one of the buttons associated with a PlayerAction. But then, ideally, if they move the mouse or press any key on the keyboard, that controller-ui content will be hidden. Is there any lower-level information I can access to learn that the last device that generated some input (even unused input) was keyboard, mouse, or controller? I'm trying to set up some common behavior where if the player does something on a controller, the screen changes to show some controller-specific content. I've tried to use the approach mentioned here, to look at the LastInputType on various PlayerActionSets, but there's a downside to that: it only fires when one of the specific PlayerActions in the PlayerActionSet is used. I didn't handle every possible case, because I didn't need everything, but here's the code I wrote:Ĭlick to expand. Is there a general approach to making one binding take on the characteristics of another? Or do I need to test what concrete BindingSource type the object is, instantiate a new one, a manually assign all of the public properties?Įdit: I did end up just creating a utility method to return a "copy" of a binding, by newing up a binding and setting its values. It doesn't seem possible to clear the BoundTo field on the copy to avoid this. Unfortunately, that results in "Binding source is already bound to action" warnings. Instead, I'm instantiating a copy of my PlayerActionSet, and using ReplaceBinding to replace the binding with the copy. Because I don't want to reset every binding (only the keyboard bindings, or only the controller bindings) I can't use 'ResetBindings', since that would reset everything. On my input screen, I let the player reset the Keyboard inputs, or reset the Controller inputs, with two distinct buttons. I was wondering what the correct approach was for resetting some, but not all, bindings in a PlayerAction to a default state? For example, I have PlayerActions that have a mix of Keyboard bindings and Controller bindings.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |