Forum Discussion
VJ76
7 years agoProtege
How can i switch the laserpointer (UIHelper) from right to the left controller?
When adding the UIHelper prefab it directly assigns it to the right controller. How can i switch it to the left controller?
Do need to change the HandedInputSelector.cs?
Do need to change the HandedInputSelector.cs?
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System;
public class HandedInputSelector : MonoBehaviour
{
OVRCameraRig m_CameraRig;
OVRInputModule m_InputModule;
void Start()
{
m_CameraRig = FindObjectOfType<OVRCameraRig>();
m_InputModule = FindObjectOfType<OVRInputModule>();
}
void Update()
{
if (OVRInput.GetActiveController() == OVRInput.Controller.LTouch)
{
SetActiveController(OVRInput.Controller.LTouch);
}
else
{
SetActiveController(OVRInput.Controller.RTouch);
}
}
void SetActiveController(OVRInput.Controller c)
{
Transform t;
if(c == OVRInput.Controller.LTouch)
{
t = m_CameraRig.leftHandAnchor;
}
else
{
t = m_CameraRig.rightHandAnchor;
}
m_InputModule.rayTransform = t;
}
}
1 Reply
Replies have been turned off for this discussion
- VJ76Protege
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device