Skip to main content
Participant
March 23, 2023

UI + Touch with Controllers

Hi All,

I've gone through all the posts, and am trying to figure out if there is a built in pointer class similar to OVRGazePointer.

I am able to get gaze pointer to work. I am also able to move OVRGazePointer references to a RHand controller, and use GazeIcon on a single hand.

However, this does not facilitate switching to left hand.

When using PrefabRuntimeController, and on OVRManager setting RenderModelSupport to Enabled, the controllers appear. I already have an OVRPointerVisualizer so the line is rendered for user with controllers. The problem is when looking at the GazePointer example, the event system is assigned a SINGLE cursor for the gaze icon. I suppose I can write a simple script on L/R triggers to switch the cursor from left to right hand, but I can't imagine this is not built into the SDK to be handled already, as I have seen other apps and both controller's have a GazeIcon (like Oculus Login / Home).

I would like to avoid 3rd party assets, and am hoping somebody has figured out how to make a controller trigger mouse/pointer events which is already built like OVRManager > OVRInputModule > OVRGazePointer.

I was hoping it would be OVRManager > OVRInputModule > OVRRuntimeController

But all that does is enable a visual.

Same with OVRManager > OVRInputModule > OVRRuntimeController

Even with OVRPointerVisualizer ( which seems to just draw the line) it does not trigger pointer/touch events

Any assistance would be greatly appreciated.

-Ebones

This topic has been closed for replies.

1 reply

EbonicusAuthor
Participant
March 23, 2023

For anyone that wants to try using the OVRGazePointer on controllers...you can easily flip it from hand to hand.

 Simple code like this will work.
 
 
using UnityEngine;
using UnityEngine.EventSystems;
 
public class PointerManager : MonoBehaviour {
 
[Header("Required References")]
public OVRGazePointer _gazePointer; // we will set active controller transform here
public OVRInputModule _ovrInputmodule; // we will set active controller transform here too
[Header("Tracking Area Controller Anchors")]
public RectTransform LControllerAnchor;
public RectTransform RControllerAnchor;
 
//All this does is switch the gazeIcon (cursor) from left to right hand.
//by flipping the Ray Transform to left and right anchors
 
 
 
void Update() {
    
//If they hit right trigger, 
if (OVRInput.GetDown(OVRInput.RawButton.RIndexTrigger)) {
//make sure it is the assigned pointer
if (_gazePointer.rayTransform != RControllerAnchor)  ChangeActiveController(RControllerAnchor);
}
 
//Do same for left
if (OVRInput.GetDown(OVRInput.RawButton.LIndexTrigger)) {
//make sure it is the assigned pointer
if (_gazePointer.rayTransform != LControllerAnchor)  ChangeActiveController(LControllerAnchor);
 
}
 
}
 
void ChangeActiveController(RectTransform which) { 
//Set it
_gazePointer.rayTransform = which;
_ovrInputmodule.rayTransform = which;
 
}
 
}