TwinStick Controls with Gamepad: 1 Vector2 and 8 component parts?

9561916--1352152--upload_2024-1-4_8-29-7.png

I’m pretty sure this is the default action Unity provides out of the box, how do they intend that you work with this? I haven’t been able to figure out how to differentiate between bindings and use those for different things because the context.ReadValue doesn’t seem to allow me to point to a specific binding. I did have luck completely bypassing the callback param and doing two seperate Gamepad.current.rightStick / lightStick, but I want to use the provided callback so I have access to rebinding etc later.

Any tips? Currently I just have one action per action, the above image looks to me like two actions in one, so you could XZ move the character and rotate the camera with the other stick. I can’t figure out how to do with though with context.readvalue, and haven’t seen this done in any samples provided by unity either. I did look at their warriors sample project, and they have a InputProvider component on their Cinemachine FreeLook camera, but that just hooks it up automagically and I want to know how it works, or how they intend for us to do it typically without cinemachine’s help.

Thanks!

Just make left and right stick separate actions. No need to leave things default. Alter them to your project.

@spiney199 sure, I did… but I’m curious how to do it the combined way, i havent been able to figure out how to do it.

Why? Not only is it the wrong way to do it, you either can’t or it would be pointlessly complicated.

One InputAction should refer to one action. One action for movement, one action for aiming.

So its officially not intended to work on the binding level?

Why does it come out of the box that way then, thats misleading at best?

No. The input system is a layer of abstraction between the action and the inputs that correspond to it. Namely, it means you don’t need to care about the specific inputs, and only have to care about the action they handle.

So an InputAction refers to one action, and can (and often will) have multiple inputs that trigger it. You should only care about registering to the actions, and not care about the individual buttons.

I’m fairly certain you’re looking at the UI action map of the default input action map asset. Which is, unsurprisingly, set up for simple UI navigation, not game-play.

I’m 99% sure the default map has separate “Move” and “Look” inputs for the default gameplay inputs, as seen here: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.7/manual/ActionAssets.html#editing-actions

So I don’t think there’s anything misleading, you’ve just confused yourself somehow.

@spiney199 thanks! Yes likely, I took their LStick & RStick under one navigation action as twin stick, not two options to do the same thing, navigate through menus… but I guess that is fine for demonstration purposes on their end.

1 Like