Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
VJ76's avatar
VJ76
Protege
6 years ago

How can i switch the laserpointer (UIHelper) from right to the left controller?

When adding the UIHelper prefab from the OculusIntergration, it directly assigns it to the right controller. How can i switch it to the left controller?
Do need to change the HandedInputSelector.cs?

7 Replies

  • Hi, so this worked for me using the Quest 2 /unity 2020.3

     

    Modify the Update Method in HandedInputSelector.cs , so that the left controller is always set as active in every frame:

     

     void Update()
        {
            //if(OVRInput.GetActiveController() == OVRInput.Controller.LTouch)
            //{
                SetActiveController(OVRInput.Controller.LTouch);
            //}
            //else
            //{
            //    SetActiveController(OVRInput.Controller.RTouch);
            //}
    
        }

     

  • Running into the same problem but the code above did not work for me... (On the Oculus Go)
  • Anonymous's avatar
    Anonymous
          if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger,OVRInput.Controller.RTouch))
            {
                SetActiveController(OVRInput.Controller.RTouch);
            }

            if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.LTouch))
            {
                SetActiveController(OVRInput.Controller.LTouch);
            }


    Replace Update code of HandedInputSelector.cs class and it starts working for both controllers
  • I found out the OVRInputModule's RayTransform was being set every frame in HandedInputSelector included in the UIHelperPrefab.
  • Hey I took a look, and here are my findings. I debugged OVRInputModule and found that RayTransform is always set to the RightHandAnchor. Even setting it to something else at runtime doesn't change it. This leads me to believe that this value is automatically set by Oculus according to the OVRInput.GetDominantHand(). However, I found no way of setting the dominant hand (only getting) through code or even in the user settings for that matter. So it seems the laser is stuck to right hand. I'll contact Oculus about this, but I don't see this being fixed quickly.
  • @Weitin Thx for your answer, but it is not working.
  • I can't confirm if this works, but I believe set the Ray Transform to LeftHandAnchor in OVRInputModule found in UIHelpers > EventSystem.