void AnchorContent(Vector3 position, GameObject prefab) { // Create a new anchor. var anchor = m_AnchorManager.AddAnchor(new Pose(position, Quaternion.identity)); // Instantiate 'prefab' as a child of the new anchor. Instantiate(prefab, anchor.transform); }
void AnchorContent(Vector3 position, Transform content) { // Create a new anchor. var anchor = m_AnchorManager.AddAnchor(new Pose(position, Quaternion.identity)); // Parent 'content' to it. content.parent = anchor.transform; }
public bool TryAddReferencePoint(Pose pose, out MarsTrackableId referencePointId) { if (m_ARReferencePointManager) { #if ARFOUNDATION_4_1_OR_NEWER var go = new GameObject("Reference point"); go.transform.SetLocalPose(pose); var pointAdded = go.AddComponent <ARAnchor>(); #elif ARFOUNDATION_3_0_1_OR_NEWER var pointAdded = m_ARReferencePointManager.AddAnchor(pose); #else var pointAdded = m_ARReferencePointManager.AddReferencePoint(pose); #endif referencePointId = pointAdded.ToMRReferencePoint().id; return(true); } referencePointId = default(MarsTrackableId); return(false); }