Using the new Input System, is there a way to stop diagonal movement?
I’m currently using:
Action Type: Pass Through
Control Type: Vector 2
Composite Type: 2D Vector
Mode: Analog
Interactions: Hold
Processors: Normalize Vector 2
Binding Path: D-Pad/Left (also Down and Right)
private void OnEnable()
{
playerControls.Enable();
playerControls.Player.Move.started += Move;
playerControls.Player.Move.performed += MoveX;
playerControls.Player.Move.canceled += StopMove;
}
private void Move(InputAction.CallbackContext context)
{
var moveX = context.ReadValue<Vector2>();
validate.MoveCheck(false, moveX);
}
private void MoveX(InputAction.CallbackContext context)
{
xIsPressed = true;
var moveX = context.ReadValue<Vector2>();
validate.MoveCheck(true, moveX);
}
private void MoveXO(InputAction.CallbackContext context)
{
xIsPressed = false;
}
I would like to continue using Vector 2 as Control Type, but have an axis override option;
pressing right you go right, then when down is triggered in addition to right (this is on xbox D-Pad), right is overridden and the character moves down rather than diagonally.
I remembered seeing that I could get separate axis readouts from the d-pad, but I can’t find that option anymore. With separate axis I can stop diagonal movement with code, but I would like to read one vector 2 rather than 2 axis readouts.
On another note the listen function for selecting the binding path stopped working, this has happened before, but I think that was due to being in the usage section, I think it was solved before by just pressing a little back arrow to get to the main menu. (I suppose this last part should be posting in the beta section as I am using 2020.1.b16)
Thank you