protected override SpongyAnchor CreateAnchor(AnchorId id, Transform parent, Pose initialPose) { DebugLogExtra($"Creating anchor {id.FormatStr()}"); initialPose = AnchorFromSpongy.Multiply(initialPose); SpongyAnchorARF newAnchor = null; #if WLT_ADD_ANCHOR_COMPONENT GameObject go = new GameObject(id.FormatStr()); go.transform.SetParent(parent); go.transform.SetGlobalPose(initialPose); ARAnchor arAnchor = go.AddComponent <ARAnchor>(); newAnchor = WrapARAnchor(id, arAnchor.trackableId, go); #else // WLT_ADD_ANCHOR_COMPONENT var arAnchor = arAnchorManager.AddAnchor(initialPose); if (arAnchor == null) { Debug.LogError($"ARAnchorManager failed to create ARAnchor {id}"); return(null); } arAnchor.gameObject.name = id.FormatStr(); newAnchor = WrapARAnchor(id, arAnchor.trackableId, arAnchor.gameObject); #endif // WLT_ADD_ANCHOR_COMPONENT Debug.Assert(newAnchor != null); return(newAnchor); }
protected override SpongyAnchor CreateAnchor(AnchorId id, Transform parent, Pose initialPose) { #if WLT_EXTRA_LOGGING Debug.Log($"Creating anchor {id.FormatStr()}"); #endif // WLT_EXTRA_LOGGING initialPose = AnchorFromSpongy.Multiply(initialPose); var arAnchor = arReferencePointManager.AddReferencePoint(initialPose); if (arAnchor == null) { Debug.LogError($"ARReferencePoinManager failed to create ARAnchor {id}"); return(null); } arAnchor.gameObject.name = id.FormatStr(); SpongyAnchorARF newAnchor = arAnchor.gameObject.AddComponent <SpongyAnchorARF>(); return(newAnchor); }