UE4使用tracker按键导致崩溃的bug处理

試著忘記壹切 提交于 2019-12-17 04:03:10

 当手柄未开始时 tracker事件导致崩溃 右手柄开启则识别为左手柄 分析结论应该是ue4的steamvr插件并没有添加tracker自定义编程输入按键处理

修复方法

在inputcore中加入各类按键事件的处理

 


 b/Engine/Source/Runtime/InputCore/Classes/InputCoreTypes.h
     static const FKey Steam_Back_Left;
     static const FKey Steam_Back_Right;
 
+    // Steam VR Controller Specific
+    static const FKey Steam_Generic_Grip;
+    static const FKey Steam_Generic_Trigger;
+    static const FKey Steam_Generic_Touchpad;
+    static const FKey Steam_Generic_Menu;
+
     // Xbox One global speech commands
     static const FKey Global_Menu;
     static const FKey Global_View;

+++ b/Engine/Source/Runtime/InputCore/Private/InputCoreTypes.cpp
const FKey EKeys::Steam_Touch_3("Steam_Touch_3");
 const FKey EKeys::Steam_Back_Left("Steam_Back_Left");
 const FKey EKeys::Steam_Back_Right("Steam_Back_Right");
 
+// Steam VR Controller Specific
+const FKey EKeys::Steam_Generic_Grip("Steam_Generic_Grip");
+const FKey EKeys::Steam_Generic_Trigger("Steam_Generic_Trigger");
+const FKey EKeys::Steam_Generic_Touchpad("Steam_Generic_Touchpad");
+const FKey EKeys::Steam_Generic_Menu("Steam_Generic_Menu");
+
 // Xbox One global speech commands
 const FKey EKeys::Global_Menu("Global_Menu");
 const FKey EKeys::Global_View("Global_View");


void EKeys::Initialize()
     AddKey(FKeyDetails(EKeys::Steam_Back_Left, LOCTEXT("Steam_Back_Left", "Steam Back Left"), FKeyDetails::GamepadKey, "Steam"));
     AddKey(FKeyDetails(EKeys::Steam_Back_Right, LOCTEXT("Steam_Back_Right", "Steam Back Right"), FKeyDetails::GamepadKey, "Steam"));
 
+    // Steam VR Controller specific
+    AddKey(FKeyDetails(EKeys::Steam_Generic_Grip, LOCTEXT("Steam_Generic_Grip", "Steam Generic Grip"), FKeyDetails::GamepadKey, "Steam"));
+    AddKey(FKeyDetails(EKeys::Steam_Generic_Trigger, LOCTEXT("Steam_Generic_Trigger", "Steam Generic Trigger"), FKeyDetails::GamepadKey, "Steam"));
+    AddKey(FKeyDetails(EKeys::Steam_Generic_Touchpad, LOCTEXT("Steam_Generic_Touchpad", "Steam Generic Touchpad"), FKeyDetails::GamepadKey, "Steam"));
+    AddKey(FKeyDetails(EKeys::Steam_Generic_Menu, LOCTEXT("Steam_Generic_Menu", "Steam Generic Menu"), FKeyDetails::GamepadKey, "Steam"));
+
     // Xbox One global speech commands
     AddMenuCategoryDisplayInfo("XBoxOne", LOCTEXT("XBoxOneSubCateogry", "XBox One"), TEXT("GraphEditor.PadEvent_16x"));
 
————————————————
版权声明:本文为CSDN博主「__AAAce」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq769919187/article/details/90475784

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!