czane
czane

Reputation: 432

ARKit how to make NSNODE persistent

very new to ARKit and want to learn.

I have created a scene and able to create 3d objects on it. They are persistent if i put the App in background but destroyed if the App is closed.

My aim is to store the coordinates of those nodes and load them persistently so I can see them every time I open the App.

Is that possible to load the nodes from previous sessions at the startup?

Thanks!

Upvotes: 1

Views: 250

Answers (2)

Neil
Neil

Reputation: 93

It's possible to keep objects persistent but they need to be persistent relative to something - a static location, an object etc.

There are a few ways to keep objects persistent with respect to space. One of them is Placenote SDK that lets you scan a physical areas and create a persistent coordinate frame relative to it. Check it out.

You can also read into the documentation here.

Upvotes: 1

Alan
Alan

Reputation: 1142

To answer your question, strictly speaking, it is possible to permanently store the positions. But these positions would be relative to where your device was finally located. So for example, let's say you're app is getting destroyed and you decide to save the location of a virtual lamp that is 1,1,1 away. When you relaunch your app and replace your virtual lamp, it will still be 1,1,1 away from where your device currently is, the point being that the distance will still just be relative to where your phone is.

Something you might be able to do is store your coordinates when your app is getting destroyed, then check the distance between where you are when you launch the app vs. when you killed the app, and then add the 1,1,1 to this distance.

Upvotes: 0

Related Questions