Search Unity

Difference between plane TrackableTypes?

Discussion in 'Handheld AR' started by BuoDev, Feb 4, 2019.

  1. BuoDev

    BuoDev

    Joined:
    Nov 28, 2018
    Posts:
    42
    What is the difference between the different .Plane-TrackableTypes? The definitions seem pretty vague to me.

    For instance,
    PlaneEstimated
    ? Like, if it isn't actually a plane, what is it, and how does it work? Since there is already
    PlaneWithinInfinity
    , which to me, sounds almost the same.

    Also, the difference between
    PlaneWithinPolygon
    and
    PlaneWithinBounds
    ?

    Lastly, is there a logic behind using just
    TrackableType.Planes
    ? Should this be used alone, or is it just to get all the possible plane trackable types in the ARRaycastHit?
     
  2. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    518
    "Estimated" means the plane has an imprecise boundary. On ARKit, for example, it corresponds to ARHitTestResultTypeEstimatedHorizontalPlane.

    "Within Infinity" means to raycast against the infinite plane.

    "Within Polygon" means the ray must hit somewhere inside the boundary points of the plane.

    "Within Bounds" means the ray must hit somewhere inside the 2d bounding box of the plane (the rectangle that encloses the boundary points).

    TrackableType.Planes
    means any of the above.
     
  3. BuoDev

    BuoDev

    Joined:
    Nov 28, 2018
    Posts:
    42
    Thanks! So if we were to order them in size, it would go:
    PlaneWithinPolygon
    <
    PlaneEstimated
    <
    PlaneWithinBounds
    <
    PlaneWithinInfinity


    Does TrackableType.Planes prioritise which plane type should be used and always fall back to the most reliable one in this order? e.g If there is two planes of different height positions, when hitting the lower plane, will it filter out the top plane's PlaneWithinInfinity? ect...
     
  4. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    518
    It's more like
    PlaneWithinPolygon
    <
    PlaneWithinBounds
    <
    PlaneEstimated
    <
    PlaneWithinInfinity
    .

    The trackable type parameter is a filter, not a priority. For example, if you specify
    PlaneWithinPolygon
    and
    PlaneWithinInfinity
    , and the hit point is within the plane's polygon, then you would have one hit whose
    hitType
    is
    PlaneWithinPolygon | PlaneWithinInfinity
    . If multiple planes intersect the ray, then you would get multiple hits, with the appropriate flags set on each hit's hitType. The results are sorted by distance from the raycast origin.
     
    dnnkeeper and BuoDev like this.