Download

Trackpad axis movement input logic 4.25

I need some help understanding how the movement axis work in UE.
I wrote simple movement functions that are based on the player camera:




[FONT=Courier New]void AVRCharacter::MoveForward(const float Value)
{
AddMovementInput(PlayerCamera->GetForwardVector(), Value);
}

void AVRCharacter::MoveRight(const float Value)
{
AddMovementInput(PlayerCamera->GetRightVector(), Value);
}


When I’m binding MoveForward to [FONT=Courier New]Vive (L) Trackpad Y, I can’t move at all. The images I’m putting below will hopefully help you visualize what I mean:

However, when I assign Vive (L) Trackpad X as well, walking forward/backward works as it should:

Here’s my 1st question - why do I have to assign both X and Y axis in order to move just in one vector? It just doesn’t seem logical to me, there’s something I’m missing.

Secondly, I’m trying to make the player be able to move right-left as well. I’m setting up the axis with X axis only. This enables me to move to the sides as well, but it doesn’t work as expected:

  • when I touch the left side of the trackpad, I’m going left AND backwards, and when I touch the right side - right and forward
  • I’m somehow able to move left-forward but even if I do, I move way too slow (the red line)

When I add a new binding, Vive (L) Trackpad Y for the MoveRight, or even remove the X and leave Y alone - I can walk only right-forward and left-backward:

So my next questions are:

  • why, for the MoveRight function, when using Trackpad Y there’s only one movement vector (right-forward/left-backward) and when using Trackpad X I’m able to move in all directions
  • for the MoveRight, what mapping should be used in order to get rid of the movement issue when I’m using Vive (L) Trackpad X only? It looks to me like an axis mapping was missing, but adding Trackpad Y mapping doesn’t work as I would expect it to.

I’ve got it solved. For some reason, Vive controllers need to be set up differently than others. In this case, both MoveForward and MoveRight need to have both X and Y, but one of them needs to be scaled to 0. Don’t know if this is by the book, but it surely works for now. This is how it looks like, compared to Rift Touch and Gamepad (both tested, gamepad used was on Xbox One controller):

04.PNG

2 Likes

Thanks for posting the solution! Saved me a lot of headache.