For a VR experience I am making, I am using the XRInputSubsystem.TryGetBoundaryPoints to map the guardian of the Oculus Quest. I have managed to get the points of the boundary.
Can someone help tell, how do I map these boundary points to a 4 point shape (rectangle) with width and length? Also how can I use it to correct and reset the recentering of the world in the Quest when it drifts off from the recenter - thus keep the world origin always in the center of the guardain?
A small note, we know there is OVR manager from Oculus, but we are making a cross platform experience so that’s why we are using Unity’s XR plugin.
I’m trying to get boundar points too, but XRInputSubsystem.TryGetBoundaryPoints doesn’t give me anything. Could you please elaborate on how did you use the method? Mine looks like this:
private void Awake()
{
List<XRInputSubsystem> list = new List<XRInputSubsystem>();
SubsystemManager.GetInstances<XRInputSubsystem>(list);
foreach (var sSystem in list)
{
if (sSystem.running)
{
_inputSubSystem = sSystem;
break;
}
}
_inputSubSystem.boundaryChanged += RefreshBoundaries;
}
private void RefreshBoundaries(XRInputSubsystem inputSubsystem)
{
List<Vector3> currentBoundaries = new List<Vector3>();
//if (UnityEngine.Experimental.XR.Boundary.TryGetGeometry(currentBoundaries))
if (inputSubsystem.TryGetBoundaryPoints(currentBoundaries))
{
//got boundaries, keep only those which didn't change.
if (currentBoundaries != null && (_boundaries != currentBoundaries || _boundaries.Count != currentBoundaries.Count))
_boundaries = currentBoundaries;
DrawWalls();
}
}
I’m using a Quest via Link and running into an issue where TryGetBoundaryPoints() returns the boundary points for the play area that I set with my Rift. Is this the same problem?
@hgabor47 Does your code also work when you use the link cable? When I use your CSharp Code my “_boundaries” are always at a Count of “0”. Could you also share your getPlayArea(); which you call in the Start() function?
An old thread I know, but if you use the above method, and then take the headset off, let it power down, then move sightly and put the headset back on, the boundary points do not update to the new position the player is in. And therefore what you show in the game is incorrect. Does anyone have a way of getting the new points, without spamming the TryGetBoundaryPoints every frame?