Jump to content

With WaveVR simulator, I can't use buttons on controller


chiepomme

Recommended Posts

With WaveVR Simulator in Vive Focus SDK v2.1.8, it seems that I can't use any button on controller.
I noticed the simulator component on unity just ignores input events from connected simulator.

So, I wrote a patch for this problem.

 

--- a/Assets/WaveVR/Scripts/TrackingPose/WaveVR_PoseSimulator.cs+++ b/Assets/WaveVR/Scripts/TrackingPose/WaveVR_PoseSimulator.cs@@ -40,6 +40,34 @@ void OnEnable()         pose_right.pose.Velocity.v0 = 0.1f;         pose_right.pose.Velocity.v1 = 0.0f;         pose_right.pose.Velocity.v2 = 0.0f;++        WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.ALL_VREVENT, OnEvent);+    }++    void OnDisable()+    {+        WaveVR_Utils.Event.Remove(WaveVR_Utils.Event.ALL_VREVENT, OnEvent);+    }++    void OnEvent(object[] args)+    {+        var ev = (WVR_Event_t)args[0];++        switch (ev.common.type)+        {+            case WVR_EventType.WVR_EventType_ButtonPressed:+                btn_right.BtnPressed |= 1UL << (int)ev.input.inputId;+                break;+            case WVR_EventType.WVR_EventType_ButtonUnpressed:+                btn_right.BtnPressed &= ~(1UL << (int)ev.input.inputId);+                break;+            case WVR_EventType.WVR_EventType_TouchTapped:+                btn_right.BtnTouched |= 1UL << (int)ev.input.inputId;+                break;+            case WVR_EventType.WVR_EventType_TouchUntapped:+                btn_right.BtnTouched &= ~(1UL << (int)ev.input.inputId);+                break;+        }     }      public WVR_Vector3f_t GetVelocity(WVR_DeviceType type)

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...