Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

AR Foundation - Stop PlaneDetection

Discussion in 'AR/VR (XR) Discussion' started by RaventurnStefan, Oct 29, 2018.

  1. RaventurnStefan

    RaventurnStefan

    Joined:
    Aug 1, 2012
    Posts:
    13
    AR Foundation 1.0.0-preview.19
    ARCore XR 1.0.0-preview.21
    ARKit XR 1.0.0-preview.16

    Hi,

    I want to pause or resume the plane detection in the AR Foundation framework. After the player found some planes and selected one of the planes, I would like to stop plane detection to to save battery and performance. (also overheating of the device)

    The solution in an other thread (AR Foundation - Pausing & Resuming tracking?,
    https://forum.unity.com/threads/ar-foundation-pausing-resuming-tracking.563272/) did not help me. It says to use arplanemanager.enabled = false;. But I don't think this is the right way to go.

    On the documentation for the AR Kit from Apple I found following:
    ARWorldTrackingConfiguration.PlaneDetection
    -- Use an empty set literal [] to specify no plane detection.
    Link: https://developer.apple.com/documentation/arkit/arworldtrackingsessionconfiguration/planedetection


    How can I use this? Thank you!

    Stefan
     
  2. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    153
    The new AR samples on github now has a sample scene that does what you want
     
  3. RaventurnStefan

    RaventurnStefan

    Joined:
    Aug 1, 2012
    Posts:
    13
    Thank you for your answer!
    I just looked at it but I am still not sure if it has been implemented correctly at the TogglePlaneDetection sample:

    The ARPlaneManager gets disabled. For this reason, the following code is called in the ARPlaneManager:

    Code (CSharp):
    1.  private void OnDisable()
    2.     {
    3.       ARSubsystemManager.planeAdded -= new Action<PlaneAddedEventArgs>(this.OnPlaneAdded);
    4.       ARSubsystemManager.planeUpdated -= new Action<PlaneUpdatedEventArgs>(this.OnPlaneUpdated);
    5.       ARSubsystemManager.planeRemoved -= new Action<PlaneRemovedEventArgs>(this.OnPlaneRemoved);
    6.       ARSubsystemManager.sessionDestroyed -= new Action(this.OnSessionDestroyed);
    7.     }
    I guess the AR Kit Api (ARWorldTrackingConfiguration.PlaneDetection) is never set to no plane detection. Or am I missing something here?
    I want to pause it properly to to save battery and performance. The iPhone is overheating quickly with running the ArKit.
    And I am not sure if disabling the ArPlaneManger only stops the intern ArFoundation events to create the planes, but forgets to call the ArKit API to really stop the detections.
     
  4. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    153
    Forget the ARKit or ARCore stuff. ARFoundation sits on top of that and you only need to Access the ARFoundation stuff

    Also check out this vid:
     
  5. RaventurnStefan

    RaventurnStefan

    Joined:
    Aug 1, 2012
    Posts:
    13
    Thanks - I know, just I'm just not sure if to pause the plane detection is correctly transposed into ArFoundation. Despite deactivating the ARPlaneManager my device gets hot, that's why I assume that something is not quite right here.
     
  6. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    153
    Ah ok, apologies I clearly misunderstood your initial question
     
  7. RaventurnStefan

    RaventurnStefan

    Joined:
    Aug 1, 2012
    Posts:
    13
    No problem, hopefully a unity developer of the ar foundation can help me :)
     
  8. RaventurnStefan

    RaventurnStefan

    Joined:
    Aug 1, 2012
    Posts:
    13
    Updated to the latest version, but the problem still exists.

    Will there be a fix for my problem? Device overheating should be a serious topic and it it would be a easy solution to stop plane detection for most games. But it must be implemented correctly to the AR Foundation framework.
     
  9. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    284
    Any update here? Also wondering, why the device is still working on full load even with detection mode set to None. The idea is to keep tracked plans position (so horoscope sync should be enabled, but no AR detection logic should be run)