/// <summary> /// Creates an Anchor at the given <c>Pose</c> that is attached to the Trackable where semantics of the /// attachment relationship are defined by the subcass of Trackable (e.g. TrackedPlane). Note that the /// relative offset between the Pose of multiple Anchors attached to the same Trackable may change /// over time as ARCore refines its understanding of the world. /// </summary> /// <param name="pose">The Pose of the location to create the anchor.</param> /// <returns>An Anchor attached to the Trackable at <c>Pose</c>.</returns> public virtual Anchor CreateAnchor(Pose pose) { IntPtr anchorHandle; if (!m_NativeApi.Trackable.AcquireNewAnchor(m_TrackableNativeHandle, pose, out anchorHandle)) { Debug.Log("Failed to create anchor on trackable."); return(null); } return(Anchor.AnchorFactory(anchorHandle, m_NativeApi)); }
/// <summary> /// Creates an Anchor at the given <c>Pose</c> that is attached to the Trackable where semantics of the /// attachment relationship are defined by the subcass of Trackable (e.g. TrackedPlane). Note that the /// relative offset between the Pose of multiple Anchors attached to the same Trackable may change /// over time as ARCore refines its understanding of the world. /// </summary> /// <param name="pose">The Pose of the location to create the anchor.</param> /// <returns>An Anchor attached to the Trackable at <c>Pose</c>.</returns> public virtual Anchor CreateAnchor(Pose pose) { if (_IsSessionDestroyed()) { Debug.LogError("CreateAnchor:: Trying to access a session that has already been destroyed."); return(null); } IntPtr anchorHandle; if (!m_NativeSession.TrackableApi.AcquireNewAnchor(m_TrackableNativeHandle, pose, out anchorHandle)) { Debug.Log("Failed to create anchor on trackable."); return(null); } return(Anchor.AnchorFactory(anchorHandle, m_NativeSession)); }