public override void OnInspectorGUI() { ARTrackedObject arto = (ARTrackedObject)target; if (arto == null) { return; } arto.MarkerTag = EditorGUILayout.TextField("Marker tag", arto.MarkerTag); ARMarker marker = arto.GetMarker(); EditorGUILayout.LabelField("Got marker", marker == null ? "no" : "yes"); if (marker != null) { string type = ARMarker.MarkerTypeNames[marker.MarkerType]; EditorGUILayout.LabelField("Marker UID", (marker.UID != ARMarker.NO_ID ? marker.UID.ToString() : "Not loaded") + " (" + type + ")"); } EditorGUILayout.Separator(); arto.secondsToRemainVisible = EditorGUILayout.FloatField("Stay visible", arto.secondsToRemainVisible); EditorGUILayout.Separator(); arto.eventReceiver = (GameObject)EditorGUILayout.ObjectField("Event Receiver:", arto.eventReceiver, typeof(GameObject), true); }
private static void DrawMarker(ARTrackedObject to, bool selected) { ARMarker m = to.GetMarker(); if (m == null) return; if (!m.gameObject.activeInHierarchy) return; // Don't attempt to load inactive ARMarkers. // Attempt to load. Might not work out if e.g. for a single marker, pattern hasn't been // assigned yet, or for an NFT marker, dataset hasn't been specified. if (m.UID == ARMarker.NO_ID) { m.Load(); } Matrix4x4 pose = to.gameObject.transform.localToWorldMatrix; //ARController.Log("pose=" + pose.ToString("F3")); switch (m.MarkerType) { case MarkerType.Square: case MarkerType.SquareBarcode: DrawSingleMarker(m, pose, selected); break; case MarkerType.Multimarker: DrawMultiMarker(m, pose, selected); break; case MarkerType.NFT: DrawNFTMarker(m, pose, selected); break; } }
public void RemoveTrackedObject(ARTrackedObject trackedObject) { ARMarker marker = trackedObject.GetMarker(); objectsForMarkers[marker].Remove(trackedObject); if (objectsForMarkers[marker].Count == 0) { objectsForMarkers.Remove(marker); } }
public void AddTrackedObject(ARTrackedObject trackedObject) { ARMarker marker = trackedObject.GetMarker(); if (objectsForMarkers.ContainsKey(marker)) { objectsForMarkers[marker].Add(trackedObject); } else { objectsForMarkers.Add(marker, new HashSet <ARTrackedObject> { trackedObject }); } }
private static void DrawMarker(ARTrackedObject to, bool selected) { ARMarker m = to.GetMarker(); if (m == null) { return; } if (!m.gameObject.activeInHierarchy) { return; // Don't attempt to load inactive ARMarkers. } // Attempt to load. Might not work out if e.g. for a single marker, pattern hasn't been // assigned yet, or for an NFT marker, dataset hasn't been specified. if (m.UID == ARMarker.NO_ID) { m.Load(); } Matrix4x4 pose = to.gameObject.transform.localToWorldMatrix; //ARController.Log("pose=" + pose.ToString("F3")); switch (m.MarkerType) { case MarkerType.Square: case MarkerType.SquareBarcode: DrawSingleMarker(m, pose, selected); break; case MarkerType.Multimarker: DrawMultiMarker(m, pose, selected); break; case MarkerType.NFT: DrawNFTMarker(m, pose, selected); break; } }