private void CloudSpatialAnchorSession_AnchorLocated(object sender, AnchorLocatedEventArgs args)
{
switch (args.Status)
{
case LocateAnchorStatus.Located:
Debug.Log("ASA Info: Anchor located! Identifier: " + args.Identifier);
QueueOnUpdate(() =>
{
// Create a green sphere.
sphere = GameObject.Instantiate(spherePrefab, Vector3.zero, Quaternion.identity) as GameObject;
sphere.AddComponent<WorldAnchor>();
sphereMaterial = sphere.GetComponent<MeshRenderer>().material;
sphereMaterial.color = Color.green;
// Get the WorldAnchor from the CloudSpatialAnchor and use it to position the sphere.
sphere.GetComponent<UnityEngine.XR.WSA.WorldAnchor>().SetNativeSpatialAnchorPtr(args.Anchor.LocalAnchor);
// Clean up state so that we can start over and create a new anchor.
cloudSpatialAnchorId = "";
tapExecuted = false;
});
break;
}
}
I'm following the Tutorial: Create a new HoloLens Unity app using Azure Spatial Anchors and when an anchor is located, the position is always on the HoloLens position (Vector3.zero).
In Output it shows some generic exceptions thrown in dlls that may have been interfering (print below).
Tutorial code:
My code:
Debug Output:
Tried different ways to set position, as utilizing ASA SDK (that in the and do the same as above):
Any suggestions?