I tried the Measure App on iOS and I noticed that the reticle automatically fits the detected plane (for horizontal planes the reticle will be horizontal and for vertical planes, it will be vertical). Even for the inclined plane, it will rotate to fit it as it is a part of it.
I am building an AR application using AR foundation.
Currently, I am just rotate my reticle on vertical and horizontal planes using this code:
if (_arRaycastManager.Raycast(screenCenter, s_Hits, TrackableType.Planes))
{
var hit = s_Hits[0];
if (_arPlaneManager.GetPlane(s_Hits[0].trackableId).alignment == PlaneAlignment.HorizontalUp ||
_arPlaneManager.GetPlane(s_Hits[0].trackableId).alignment == PlaneAlignment.HorizontalDown)
{
Reticle.transform.eulerAngles = new Vector3(90, 0, 0);
}
else if (_arPlaneManager.GetPlane(s_Hits[0].trackableId).alignment == PlaneAlignment.Vertical)
{
Reticle.transform.eulerAngles = new Vector3(0, 0, 0);
}
Reticle.transform.position = hit.pose.position;
}
Is there a way to implement the behaviour of measure app reticle in my application.