sceneView.projectPoint is incredibly slow?

I need to run sceneView.projectPoint a couple of 100 times in a loop, it freezes my app regularly... not always. Sometimes it freezes for a second sometimes for 10 seconds.


Any ideas?

Accepted Reply

I don't know whether this will be helpful in your case, but here's something I've determined in my app...

As noted in this discussion, projectPoint() can apparently block if it is called on two different threads at the same time.

I find that projectPoint() is quite fast when called within one of my SCNSceneRendererDelegate methods. These are called in the SCNRenderer render thread; presumably iOS is not making its own calls to projectPoint() while any of these delegate methods are active.

But if I call projectPoint() from the main UI thread, its execution time is quite variable and often quite slow. I'm guessing that it is blocking whenever it happens to also be called simultaneously by iOS in the SCNRenderer render thread.

Replies

I don't know whether this will be helpful in your case, but here's something I've determined in my app...

As noted in this discussion, projectPoint() can apparently block if it is called on two different threads at the same time.

I find that projectPoint() is quite fast when called within one of my SCNSceneRendererDelegate methods. These are called in the SCNRenderer render thread; presumably iOS is not making its own calls to projectPoint() while any of these delegate methods are active.

But if I call projectPoint() from the main UI thread, its execution time is quite variable and often quite slow. I'm guessing that it is blocking whenever it happens to also be called simultaneously by iOS in the SCNRenderer render thread.