Skip to main content
July 10, 2019

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

Inspiring
July 12, 2019
I can't confirm if this works, but I believe set the Ray Transform to LeftHandAnchor in OVRInputModule found in UIHelpers > EventSystem.
Wei Tin Yuen, VR Developer B) Toronto, Canada http://tinforge.com/
July 12, 2019
@Weitin Thx for your answer, but it is not working.
Inspiring
July 15, 2019
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.
Wei Tin Yuen, VR Developer B) Toronto, Canada http://tinforge.com/
Inspiring
July 18, 2019
I found out the OVRInputModule's RayTransform was being set every frame in HandedInputSelector included in the UIHelperPrefab.
Wei Tin Yuen, VR Developer B) Toronto, Canada http://tinforge.com/
February 26, 2020
      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
Up and Coming
March 13, 2020
Running into the same problem but the code above did not work for me... (On the Oculus Go)
brunofantini
New Participant
June 21, 2022

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);
        //}

    }