arcore-unity-extensions icon indicating copy to clipboard operation
arcore-unity-extensions copied to clipboard

How to prevent GameObjects from drifting when using GeoAnchors

Open mpriem opened this issue 3 years ago • 2 comments

I'm using Geospatial Anchors and instantiating GameObjects with these anchors as the parent as per the online documentation

if (earthTrackingState == TrackingState.Tracking) { var anchor = AnchorManager.AddAnchor( latitude, longitude, altitude, quaternion); var anchoredAsset = Instantiate(GeospatialAssetPrefab, anchor.transform); }

The GameObjects keep drifting in the scene because the anchors are continuously updated and therefore their location changes.

What is the (best) way to fix the objects in place?

mpriem avatar Oct 16 '22 19:10 mpriem

Instead of instantiating the gameobjects as children of the anchor, try just placing them at the detected anchor position and rotation.

halfspacer avatar Dec 05 '22 10:12 halfspacer

@halfspacer thanks for your reply.

I have taken various approaches but was hoping to get some guidance from the creators.

The best approach I found so far is to keep track of the accuracy of the camerageospatialpose in earthmanager and replace the anchor when it improves and remove the anchor as parent once a target accuracy is reached.

This approach is used in PocketGarden which is IMHO one of the best showcases for ARCore you can find on GitHub.

mpriem avatar Dec 06 '22 11:12 mpriem