Open erikparr opened 6 years ago
Thank you for reaching out and pointing this problem out. Are you able to consistently reproduce the issue?
Yes - consistent every time showPlanes is enabled for THREE.ARDebug. When showPlanes is false the error disappears.
I can confirm this error. It happens every new suface be found after reload the page in the WKWebView.
I have a workaround, hope it helps. https://github.com/ITJesse/WebARonARKit/commit/833a90d7679a0375a699700fe330f3ab59e8b966
Thanks, @ITJesse - I left a comment on your fix. This is a deeper problem as basically we are getting the events out-of-order, which can result in all kinds of badness like recreating deleted planes if we get an update after a delete. The correct fix is to handle the events on the native side where they come in the correct order and then send a batch add/update/remove event to JS along with each frame update so it can't come in out-of-order on the JS side.
@ITJesse I left another comment - would like to get a band-aid in there but I think the best fix is to change onPlaneUpdated_, where the crash happens, to just ignore the update if the plane doesn't exist. That will prevent us from leaking planes if the update/delete come in reverse order. Do you want to make that fix?
I will try it later. Thanks.
@lincolnfrog I have done some research these days. And I found that it maybe caused by a "dummy restart" of ARSession. See here.
All of the planes had found is still left in the native side. This will cause the data to be out of sync between native and WKWebkit side after a web page reload happened (maybe out-of-memory, refresh, and so on).
So when we found a plane again, the native will fire a onPlaneUpdate event instead of a onPlaneAdded event which we expect.
Hi - Very nice project here. I'm exploring your examples and I keep getting the following error on plane finder example. I am on WebARonARKit, ios 11.2.5 three.js .89, and three.ar.js 1.7