public virtual void OnTagLocated(ImageTagLocation location)
 {
     if (SwigDerivedClassHasMethod("OnTagLocated", swigMethodTypes0))
     {
         SharingClientPINVOKE.ImageTagLocationListener_OnTagLocatedSwigExplicitImageTagLocationListener(swigCPtr, ImageTagLocation.getCPtr(location));
     }
     else
     {
         SharingClientPINVOKE.ImageTagLocationListener_OnTagLocated(swigCPtr, ImageTagLocation.getCPtr(location));
     }
 }
Exemplo n.º 2
0
    void OnTagLocated(ImageTagLocation location)
    {
        //Debug.Log("Found tag");
        //Debug.Log(location.GetPixelX(ImageTagLocationType.Center));
        //Debug.Log(location.GetPixelY(ImageTagLocationType.Center));

        int id = location.GetTagId();

        Vector2 tag_pos = new Vector2();

        tag_pos.x = location.GetPixelX(ImageTagLocationType.Center);
        tag_pos.y = location.GetPixelY(ImageTagLocationType.Center);

        tag_pos.x /= cam_width;
        tag_pos.y /= cam_height;

        tag_pos   *= -2; //negate it, since we're looking at the image effectively rotated 180 degrees (the image left ends up on the right of the plane)
        tag_pos.x += 1;
        tag_pos.y += 1;

        Vector3 virtual_pos = plane_up * half_height * tag_pos.y + plane_right * half_width * tag_pos.x;

        virtual_pos += gameObject.transform.position;

        Vector2 top_left  = new Vector2();
        Vector2 top_right = new Vector2();

        GameObject obj;

        if (tag_objects.TryGetValue(id, out obj))
        {
            obj.transform.position = virtual_pos;
        }
        else
        {
            obj = GameObject.CreatePrimitive(PrimitiveType.Cube); //instantiate obj here
            obj.transform.position = virtual_pos;
            tag_objects.Add(id, obj);
        }

        cur_frame_tags.Add(id);
        prev_frame_tags.Remove(id);

        //Debug.Log(frame_time);
    }
Exemplo n.º 3
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageTagLocation obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageTagLocation obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
 public virtual void OnTagLocated(ImageTagLocation location) {
   if (SwigDerivedClassHasMethod("OnTagLocated", swigMethodTypes0)) SharingClientPINVOKE.ImageTagLocationListener_OnTagLocatedSwigExplicitImageTagLocationListener(swigCPtr, ImageTagLocation.getCPtr(location)); else SharingClientPINVOKE.ImageTagLocationListener_OnTagLocated(swigCPtr, ImageTagLocation.getCPtr(location));
 }