Download

Getting second Vive controller input buttons

We have buttons coming from the first controller (id 0) using the input system. It returns them as Gamepad:LeftTrigger in the input system.

We can bind actions to this as follows:
InputComponent->BindAction(“ViveUseLeft”, IE_Pressed, this,
&ACharacter::UseItemLeftPressed);
InputComponent->BindAction(“ViveUseLeft”, IE_Released, this,
&ACharacter::UseItemLeftReleased);

But when I try to set this up for the right controller (id 1) we don’t get any messages. I have tried Gameplay:RightTrigger and other messages.

Any clue as to how I can get button messages for both controllers?

I resolved this by checking if the input was from the second controller then I map that to the Right gamepad messages.

Works fine.

Unfortunately, with 4.8, because UE4 limits you to one physical controller per player (any physical controller, not just SteamVR controllers), you have to do a few steps to route input:

  1. Make sure your project settings are set to not go into splitscreen
  2. Create a second player, using CreatePlayer (BP), or CreateLocalPlayer (C++)
  3. Handle the input events for the second controller in that player, and call functions / events on the primary player.

I’ve just submitted code which removes the necessity for that hack, which makes this trivial in the future. You have separate input events (e.g. Motion Controller (Left) Trigger and Motion Controller (Right) Trigger), which all route to the same player.

Hi Nick,

What’s the best way to get this code?

Thanks

Hi Nick,

Can you point me to the device-agnostic motion controller interface on github? I searched but couldn’t find it. I’d like to implement that interface using my PSMove plugin.

Cheers,
Chad

is that from this commit? https://github.com/EpicGames/UnrealEngine/commit/7feaa6c836ec4946e791fb8d7525b88580c57689