Hi Guys, I want to disable the plane detection after I had detected a plane of certain size, so far I am only able to get list of all planes and selectively disable them. What I want to achieve , is that instead of detecting multiple planes , detect only one plane and track it . Secondly, i want to check if the plane mesh is of certain size and disable it accordingly.
You can subscribe to the ARPlaneManager's plane events and disable the instantiated plane if it does not fit your criteria. When you want to disable plane detection entirely, simply disable the ARPlaneManager.
I have found that disabling the ARPlaneManager repeatedly during an AR Session will crash iOS devices, and there is also a lot screen flickering that occurs prior to the crash, due to exceeding the iOS limitations on "wakeups". Event: wakeups Action taken: none Wakeups: 45001 wakeups over the last 169 seconds (266 wakeups per second average), exceeding limit of 150 wakeups per second over 300 seconds Wakeups limit: 45000 Limit duration: 300s Wakeups caused: 45001 Duration: 17.01s Steps: 18 I was simply enabling the ARPlaneManager script when the user was touching the screen, and then disabling the script when the user stopped touching the screen. Turning this behavior off stopped the flickering and the crashing, so the problem has to be related to ARKit since my Android builds have no issue with the ARPlaneManager script being toggled on and off.
I'm not really sure what a "wakeup" event is in this context. It sounds like the notification screen on iOS, but I don't see why that would be related to an ARKit app. Also, if there are 266 such events per second, I wonder if you're disabling/enabling plane detection every frame rather than just on touch begin and end. It'd be great if you could get a callstack for the crash and submit a bug report.
https://forum.unity.com/threads/in-arworldmap-how-to-check-if-the-models-are-relocalized.667138/ Any idea how it works after the Gameobjects are relocalized ... without disappering the Gamobjects(ie without restarting the tracking).
Which event should I subscribe to? My code is currently like this: Code (CSharp): private ARPlaneManager planeManager; private ARPlane plane; void Awake() { planeManager = GetComponent<ARPlaneManager>(); plane = GetComponent<ARPlane>(); } void OnEnable() { plane.boundaryChanged += OnPlaneBoundaryChanged; } void OnDisable() { plane.boundaryChanged -= OnPlaneBoundaryChanged; } void OnPlaneBoundaryChanged(ARPlaneBoundaryChangedEventArgs args) { float planeArea = plane.size.x * plane.size.y; Debug.Log("Current plane area: " + planeArea); if (planeArea > 2.5f) { planeManager.enabled = false; Debug.Log("Plane manager is " + planeManager.enabled); } } Also, how do you disable the plane detection? Like, this? Code (CSharp): planeManager.enabled = false;