Search Unity

PlaneWithinBound not working

Discussion in 'AR' started by Cruxx, Jun 9, 2019.

  1. Cruxx

    Cruxx

    Joined:
    Nov 3, 2018
    Posts:
    6
    When I try to use the ARRaycastManager, only estimated planes type can generate hits, while PlaneWithinPolygon and PlaneWithinBound can not. Are those types unusable now, or do they require special setup?
     
  2. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    I use
    PlaneWithinPolygon
    almost exclusively in my tests and samples and am not aware of any issues. Can you provide more details or sample code?
     
  3. Cruxx

    Cruxx

    Joined:
    Nov 3, 2018
    Posts:
    6
    Thank you for your reply!

    Here are the details of my testing environment:
    - Unity 2019.3.04a personal
    - ARFoundation 2.1.0 preview3
    - ARKit XR plugin 2.0.1
    - Operating system: OSX
    - Test device: Iphone XR

    Here is how I used the ARRaycast manager:
    -First I attach the ARRaycastManager component to the AR Session Origin object.
    -Then, I call this method
    MyRaycastManager.Raycast(screenCenter,hits,UnityEngine.XR.ARSubsystems.TrackableType.PlaneEstimated);
    to get all the raycast hits in my list "hits"
    -Finally, I call this code
    Bool HaveHit = (hits.Count >0);
    in every update to check if the recast has any hit or not.

    The issue:
    If I use TrackableType.PlaneWithinPolygon or PlaneWithinBound, the HaveHit boolean will always be false, while if I use Plane Estimated, some planes can be detected. I have not use the ARPlaneManager, which I think is more about visualize the plane instead of about detecting.
     
  4. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    You've got that exactly backwards :) The ARPlaneManager has everything to do with detecting and nothing to do with visualizing. Whether you visualize the planes is up to you (i.e., the "Plane Prefab" field). Our samples, for example, use a prefab which includes a mesh renderer to visualize the plane.

    The raycast manager can't raycast against planes that haven't been detected yet, and for that you need to enable plane detection with the ARPlaneManager. Some platforms can probably give you an estimate when plane detection hasn't been enabled, which is why you are only seeing results for plane estimated.
     
  5. Cruxx

    Cruxx

    Joined:
    Nov 3, 2018
    Posts:
    6
    Thank you so much! I will have a closer look at those samples. That's really helpful!