12-22-2019 09:41 AM
01-24-2020 03:58 AM
03-03-2020 01:47 PM
07-15-2020 09:02 AM
04-27-2021 08:20 AM
I was using the Hands prefab back in the day since I only had the old oculus plugin and using unity 2018. So the goal was to override ray transform property of OVRInputModule which is in the event system and the ray transform of the OVRGazePointer which you can access via the static class instance. To solve these using the old hands prefab way we need to do it by code...
You need to get the ray transform from the ray tool. The ray tool is spawned dynamically by the InteractableToolsSDKDriver prefab. I marked the right ray tool with a tag so i can access it later.
RayTool.cs
public void Initialize()
{
...
if(IsRightHandedTool)
{
gameObject.tag = "RightRayTool";
}
}
I then expose the target ray from RayToolView.cs which can be accessed from RayTool.cs
RayToolView.cs
public Transform GetTargetTransform()
{
return _targetTransform;
}
RayTool.cs
public Transform GetRay()
{
return _rayToolView?.GetTargetTransform();
}
Then I use it in my overrider class accordingly
Overrider.cs
in awake() and make sure tag is in tagasset...
var rayTool = GameObject.FindGameObjectWithTag("RightRayTool")?.GetComponent<RayTool>();
coroutine some time later when hands are ready...
OVRGazePointer pointer = OVRGazePointer.instance;
pointer.rayTransform = rayTool.GetRay();
ovrInput.rayTransform = rayTool.GetRay();
//NOTE: ovrinput is referenced from the component in eventsystem object