arcore-unity-extensions
arcore-unity-extensions copied to clipboard
How to prevent GameObjects from drifting when using GeoAnchors
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?
Instead of instantiating the gameobjects as children of the anchor, try just placing them at the detected anchor position and rotation.
@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.