Editor crashes with Vive trackers.

Checked both on 4.16.3 and 4.17.0.

When I launch editor with more than 2 Vive trackers, it crashes.

Debugging led me to the SlateApplication.cpp@5852 and SteamVRController.cpp@366, which gets Invalid as type of game pad key (button?) for the tracker. It seems that it reads wrong values from VR saying that some tracker buttons those have been pressed being released while type of the button is unknown. It seems that it tries to handle trackers as controllers, and attaches them to hands prior to real controllers.

It seems to be fine if I start editor with only 2 motion controllers enabled, then enable trackers one by one.

I’m running into the same problem (UE 4.17.2) - although for me it is impossible to get it to work. Regardless of how or in what order I enable my motion controllers and trackers.

I have looked at the code and I am unable to find a way how this can work in the first place (which makes me wonder if this code was even tested).

Anyway, what happens is that in FSteamVRController::SendControllerEvents all the SteamVR buttons get polled and when a button press is detected the following code gets called:

MessageHandler->OnControllerButtonPressed(ButtonId, ControllerIndex, /*IsRepeat =*/false);

The ButtonId argument contains the name UE has given to the Vive tracker’s trigger button, which is “Steam_Generic_Trigger” (so far so good).

The call ends up at:

bool FSlateApplication::OnControllerButtonPressed( FGamepadKeyNames::Type KeyName, int32 ControllerId, bool IsRepeat )
{
    FKey Key(KeyName);
    check(Key.IsValid());

FKey::isValid then checks the passed KeyName argument against button names listed in InputCoreTypes.cpp. Unfortunately InputCoreTypes.cpp does not have a key named “Steam_Generic_Trigger” and UE crashes because of call being made on a null pointer.

Try to restart SteamVR and turn on Vive Trackers in another sequence. It usually helps for me. At least before any input from controllers or trackers.

Sounds like unreliable workaround. It is quite annoying to restart trackers every time in correct sequence. But anyway thanks for advice.

Yep this is exactly the conclusion I came too. And is still an issue in 4.18. It’s a little over my skills to dig in and fix this but I did hack it by modifying SteamVRController.cpp and changing the key name to another gamepad input for Special_1 controller. It works for my case until epic has a better solution. No more crashes at least and the button fires an event.

I am having the same error, could you please share your solution?

in the mean time I have been trying to add the “Steam_Generic_Trigger” in InputCoreTypes to make a proper fix and a pullrequest to Unreal code.

Hey there,
i ran into the same problem in engine version 17.2/18.2. Since i dont feel very comfortabel in scripting, i would really appreciate a less cryptic description of your solution. Maybe you can just share your SteamVRController file or at least the lines you changed.
cheers!

I just manage to fix this crash, but for some reason the PPGun that I am using also opens the Steam overlay anytime I press the trigger. I will be updating the code to a fork of Unreal Engine at the github of VRMonkey, I will let you guys know when I do it.

I’ve added these lines around line 240 of steamvrcontroller.cpp. Again this maps the first detected vive tracker to gamepad events. I then setup the gamepad d pad events in blueprint to fire off code when the trackers are used as input.

Buttons[(int32)EControllerHand::Special_1][ESteamVRControllerButton::TriggerPress] = FGamepadKeyNames::DPadUp;
Buttons[(int32)EControllerHand::Special_1][ESteamVRControllerButton::Grip] = FGamepadKeyNames::DPadDown;
Buttons[(int32)EControllerHand::Special_1][ESteamVRControllerButton::TouchPadPress] = FGamepadKeyNames::DPadLeft;
Buttons[(int32)EControllerHand::Special_1][ESteamVRControllerButton::ApplicationMenu] = FGamepadKeyNames::DPadRight;

@Pekayatt: Have you managed to implement this change yet? also can you explain a little on how you fixed the crash? I am getting the same issue when i send trigger values/presses through tracker USB to UE4 4.18.0.

See TheFoyer’s answer above. UE doesn’t support input events from Vive Trackers, so they cause crash. Still no fix in 4.19, so i’ll try add a new bug report via new form :frowning:

File to edit:
[Engine/Plugins/Runtime/Steam/SteamVR/Source/SteamVRController/Private/SteamVRController.cpp] file.

Add this lines after line 237 (within the for() loop):

Buttons[SpecialIndex][ESteamVRControllerButton::TriggerPress] = FGamepadKeyNames::PadUp;

Buttons[SpecialIndex][ESteamVRControllerButton::Grip] = FGamepadKeyNames::PadDown;

Buttons[SpecialIndex][ESteamVRControllerButton::TouchPadPress] = FGamepadKeyNames::PadLeft;

Buttons[SpecialIndex][ESteamVRControllerButton::ApplicationMenu] = FGamepadKeyNames::PadRight;

Thanks @YuriNK , I should have mentioned that I have set up the tracker as a controller using the role changer program from HTC, I upgraded to 4.18.2 this morning and the crashes stopped :slight_smile:

Thank you, I’ll try it too then.

But does Unreal supports many ‘controllers’, not just right and left?

@YuriNK “Add this lines after line 237 (within the for() loop):”,It doesn’t work,still crash…

It’s steam vr that only supports 2 controllers but yes you are correct, my application only needs one controller and a tracker.

Hey YuriNK, did you ever submitted the bug? Did anyone ever submitted a bug? Can’t one about this

Of course, there was two bug reports on answerhub and one via new bug report form.

I did upload the engine with the changes on https://github.com/VRMonkey/UnrealEngine/tree/4.18

Let me know if anyone tries from here…

@pekayatt
Is this repository private? I’d like to try, but I get 404 error.

It should be open, but you need to have access to the Unreal Engine rep.