cancel
Showing results for 
Search instead for 
Did you mean: 

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

VJ76
Protege
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 7

Weitin
Protege
I can't confirm if this works, but I believe set the Ray Transform to LeftHandAnchor in OVRInputModule found in UIHelpers > EventSystem.

VJ76
Protege
@Weitin Thx for your answer, but it is not working.

Weitin
Protege
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
Protege
I found out the OVRInputModule's RayTransform was being set every frame in HandedInputSelector included in the UIHelperPrefab.

Anonymous
Not applicable
      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

FuzzyOnion
Protege
Running into the same problem but the code above did not work for me... (On the Oculus Go)

bruno.fantini
Explorer

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

    }