How there is “Gamepad.current.dpad” and there isn’t “Keyboard.current.wasd” and “Keyboard.current.dpad”?
It’s super sad that i have to this way.
var wasdDirection = new Vector2(
keyboard.wKey.ReadValue() - keyboard.sKey.ReadValue(),
keyboard.dKey.ReadValue() - keyboard.aKey.ReadValue()
);
var dpadDirection = new Vector2(
keyboard.upArrowKey.ReadValue() - keyboard.downArrowKey.ReadValue(),
keyboard.rightArrowKey.ReadValue() - keyboard.leftArrowKey.ReadValue()
);
Why should it be there?
DPad, aka Digital Pad is a distinct physical control on a game pad.
That you use WSAD for moving a character on the keyboard, is not “one physical” control but for that form a direction. If that would be there, there must also be .leftRightUpDownArrow thing or for local coop games maybe a .ijkl thing.
Does not make sense.
You can simply compose whatever you need from your physical keys, either set it up via code like you did or the visual approach.
Because these shortcuts are based off of the physical controls on the device.
Outside of prototyping you shouldn’t be doing it this way either as you risk getting negative reviews from people who want to use other keys or have keyboards with alternative layouts.
Ah i didn’t know that directional pad was a unique block of physical controls.
I was thinking the API was made to make it simple as common feature (Yeah i know that you cannot physically move the keys, but either other common configuration you cannot), and that’s because i was complaining about that there isn’t WASD and KDPAD.
Thanks for the responses.
Anyway, yes i was prototyping. Btw if i don’t want to support rebinding or alternative layouts in the final product, it is too problematic to do this way? Anyway that’s good to know, sure it’s on list.
I was not talking about “character”, whatever. I was talking about “why” gamepad has API physically mapped such as Gamepad.Dpad
and Keyboard not have a API such as Keyboard.Wasd
, this was my sentence. For me make sense to exists, and is quite useful only when is mapped using some sort of internal localization, using keyboard layouts (EN, IT, FR. etc…). Example: Gamepad Arrows remains as is whatever gamepad you use, ps4, ps3, xbox, switch… etc…, but keyboard is pretty disposed in a way that change based on the keyboard layout, that’s why you cannot rely on “Use whatever key you want and build your own” that’s why you cannot and why Gamepad in way more reliable then the keyboard.