Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

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


chiepomme
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...