コード例 #1
0
    public override void OnInspectorGUI()
    {
        ARTrackedObject arto = (ARTrackedObject)target;

        if (arto == null)
        {
            return;
        }

        arto.TrackableTag = EditorGUILayout.TextField("Marker tag", arto.TrackableTag);

        ARTrackable trackable = arto.GetTrackable();

        EditorGUILayout.LabelField("Got marker", trackable == null ? "no" : "yes");
        if (trackable != null)
        {
            string type = ARTrackable.TrackableTypeNames[trackable.Type];
            EditorGUILayout.LabelField("Marker UID", (trackable.UID != ARTrackable.NO_ID ? trackable.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);
    }
コード例 #2
0
    private static void DrawMarker(ARTrackedObject to, bool selected)
    {
        ARTrackable m = to.GetTrackable();

        if (m == null || m.enabled == false)
        {
            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 == ARTrackable.NO_ID)
        {
            m.Load();
        }

        Matrix4x4 pose = to.gameObject.transform.localToWorldMatrix;

        //ARController.Log("pose=" + pose.ToString("F3"));

        switch (m.Type)
        {
        case ARTrackable.TrackableType.Square:
        case ARTrackable.TrackableType.SquareBarcode:
            DrawSingleMarker(m, pose, selected);
            break;

        case ARTrackable.TrackableType.Multimarker:
            DrawMultiMarker(m, pose, selected);
            break;

        case ARTrackable.TrackableType.NFT:
        case ARTrackable.TrackableType.TwoD:
            DrawNFTMarker(m, pose, selected, false);
            break;
        }
    }