/// <inheritdocs /> public bool RemoveAlignmentAnchor(AnchorId anchorId) { bool found = false; if (anchorId.IsKnown()) { for (int i = referencePoses.Count - 1; i >= 0; --i) { if (referencePoses[i].anchorId == anchorId) { poseDB.Forget(referencePoses[i].name); referencePoses.RemoveAt(i); found = true; } } for (int i = referencePosesToSave.Count - 1; i >= 0; --i) { if (referencePosesToSave[i].anchorId == anchorId) { referencePosesToSave.RemoveAt(i); } } } return(found); }
/// <summary> /// Remove all internal references to the anchor identified. /// </summary> /// <param name="id">The anchor to forget.</param> /// <remarks> /// It is not an error to pass in AnchorId.Unknown or AnchorId.Invalid, although neither will have any effect. /// It is an error to pass in a valid id which doesn't correspond to a valid anchor. /// This function should be called as part of any IAnchorManager's implementation of DestroyAnchor(). /// </remarks> protected void RemoveSpongyAnchorById(AnchorId id) { if (id.IsKnown()) { plugin.RemoveFrozenAnchor(id); int index = SpongyAnchors.FindIndex(anchorWithId => anchorWithId.anchorId == id); if (index >= 0) { Debug.Assert(index < SpongyAnchors.Count); SpongyAnchors.RemoveAt(index); } } }
/// <inheritdocs /> public bool GetAlignmentPose(AnchorId anchorId, out Pose lockedPose) { /// mafinc - if any perf issue shows up, this could be a dictionary. if (anchorId.IsKnown()) { for (int i = 0; i < referencePoses.Count; ++i) { if (referencePoses[i].anchorId == anchorId) { lockedPose = referencePoses[i].LockedPose; return(true); } } } lockedPose = Pose.identity; return(false); }