public void OnTrackingFound(Trackable trackable)
        {
            bool matches = false;

            if (string.IsNullOrEmpty(_expectedId) || (_expectedId == trackable.name))
            {
                matches = true;
            }

            if (matches)
            {
                _trackableId = trackable.name;
                this.gameObject.SetActive(true);
            }
        }
Exemple #2
0
        public override void ProcessFrame()
        {
            Vector3    position;
            Quaternion orientation;

            _kudanTracker.ArbiTrackGetPose(out position, out orientation);

            Trackable trackable = new Trackable();

            trackable.position    = position;
            trackable.orientation = orientation;

            trackable.isDetected = _kudanTracker.ArbiTrackIsTracking();

            _updateMarkerEvent.Invoke(trackable);
        }
Exemple #3
0
        // Trackables
        public override bool AddTrackable(byte[] data, string id)
        {
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
            bool     result = NativeInterface.AddTrackableSet(handle.AddrOfPinnedObject(), data.Length);

            handle.Free();

            if (result)
            {
                Trackable trackable = new Trackable();
                trackable.name = id;
                _trackables.Add(trackable);
            }

            return(result);
        }
Exemple #4
0
        // Trackables
        public override bool AddTrackable(byte[] data, string id)
        {
            bool result = false;

            if (m_KudanAR_Instance != null)
            {
                result = m_KudanAR_Instance.Call <bool>("AddTrackableSet", data, data.Length);
            }

            if (result)
            {
                Trackable trackable = new Trackable();
                trackable.name = id;
                _trackables.Add(trackable);
            }

            return(result);
        }
Exemple #5
0
        /// <summary>
        /// Method called when a marker has been found.
        /// Checks whether the detected marker is the correct one by checking it against the expected ID.
        /// </summary>
        /// <param name="trackable">Trackable.</param>
        public void OnTrackingFound(Trackable trackable)
        {
            bool matches = false;

            //if (_expectedId == trackable.name)
            //{
            //	matches = true;
            //}
            if (_expectedId.Contains(trackable.name))
            {
                matches = true;
            }

            if (matches)
            {
                _trackableId = trackable.name;
                this.gameObject.SetActive(true);
            }
        }
Exemple #6
0
        private List <Trackable> GetDetected()
        {
            int num = 0;

            if (m_KudanAR_Instance != null)
            {
                num = m_KudanAR_Instance.Call <int>("GetNumberOfDetectedTrackables");
            }

            // Grab detected trackables from java/native/kudan-lib into C# Unity land
            List <Trackable> result = new List <Trackable>(num);

            for (int i = 0; i < num; i++)
            {
                AndroidJavaObject thisTrackable            = m_KudanAR_Instance.Call <AndroidJavaObject>("GetTrackable", i);
                AndroidJavaObject thisTrackablePosition    = thisTrackable.Get <AndroidJavaObject>("m_Position");
                AndroidJavaObject thisTrackableOrientation = thisTrackable.Get <AndroidJavaObject>("m_Orientation");

                Trackable trackable = new Trackable();
                trackable.name   = thisTrackable.Get <string>("m_Name");
                trackable.width  = thisTrackable.Get <int>("m_Width");
                trackable.height = thisTrackable.Get <int>("m_Height");
                //
                // Works for 180 rotated camera
//				trackable.position = new Vector3( thisTrackablePosition.Get<float>( "x" ), thisTrackablePosition.Get<float>( "y" ), -thisTrackablePosition.Get<float>( "z" ) );
//				trackable.orientation = new Quaternion( -thisTrackableOrientation.Get<float>( "y" ), thisTrackableOrientation.Get<float>( "x" ), thisTrackableOrientation.Get<float>( "w" ), -thisTrackableOrientation.Get<float>( "z" ) );
                //
                trackable.position    = ConvertNativeFloatsToVector3(thisTrackablePosition.Get <float>("x"), thisTrackablePosition.Get <float>("y"), thisTrackablePosition.Get <float>("z"));
                trackable.orientation = ConvertNativeFloatsToQuaternion(thisTrackableOrientation.Get <float>("x"), thisTrackableOrientation.Get <float>("y"), thisTrackableOrientation.Get <float>("z"), thisTrackableOrientation.Get <float>("w"));

//				Debug.LogError( "[KudanAR] trackable.orientation: " + trackable.orientation );

                result.Add(trackable);

                thisTrackable.Dispose();
            }

            return(result);
        }
Exemple #7
0
        /// <summary>
        /// Method called every frame the marker has been tracked.
        /// Updates the position and orientation of the trackable.
        /// </summary>
        /// <param name="trackable">Trackable.</param>
        public void OnTrackingUpdate(Trackable trackable)
        {
            if (_trackableId == trackable.name)
            {
                if (hasInvertedCamera())
                {
                    this.transform.localPosition = new Vector3(-trackable.position.x, -trackable.position.y, trackable.position.z);
                }

                else
                {
                    this.transform.localPosition = trackable.position;
                }

                this.transform.localRotation = trackable.orientation * quat;

                if (_applyMarkerScale)
                {
                    this.transform.localScale = new Vector3(trackable.height / UnityScaleFactor, 1f, trackable.width / UnityScaleFactor);
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// Method called every frame the marker has been tracked.
        /// Updates the position and orientation of the trackable.
        /// </summary>
        /// <param name="trackable">Trackable.</param>
        public void OnTrackingUpdate(Trackable trackable)
        {
            if (_trackableId == trackable.name)
            {
                if (hasInvertedCamera())
                {
                    this.transform.localPosition = new Vector3(-trackable.position.x, -trackable.position.y, trackable.position.z);
                }

                else
                {
                    this.transform.localPosition = trackable.position;
                }

                this.transform.localRotation = trackable.orientation;

                if (_applyMarkerScale)
                {
                    this.transform.localScale = new Vector3(trackable.height / UnityScaleFactor, 1f, trackable.width / UnityScaleFactor);
                }



                Touch[] touch = Input.touches;
                for (int i = 0; i < Input.touchCount; i++)
                {
                    Touch t = touch[i];
                    if (t.deltaTime > 0.2f) // if long touch
                    {
                        switch (trackable.name)
                        {
                        // Front cover
                        case "P1":
                            Application.OpenURL("https://www.xlsoft.com/jp/index.html");
                            break;

                        case "P2-3":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/intel/index.html");
                            break;

                        case "P4":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/pkware/index.html");
                            break;

                        case "P5-Docker":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/docker/index.html");
                            break;

                        case "P5-Atlassian":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/atlassian/index.html");
                            break;

                        case "P5-nsoftware":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/nsoftware/index.html");
                            break;

                        case "P6-cdata":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/cdata/index.html");
                            break;

                        case "P6-sentryone":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/sentryone/index.html");
                            break;

                        case "P6-realm":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/realm/index.html");
                            break;

                        case "P7":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/kong/index.html");
                            break;

                        case "P8-arm":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/arm/index.html");
                            break;

                        case "P8-cache":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/intel/cas/index.html");
                            break;

                        case "P8-intel":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/intel/dcm/index.html");
                            break;

                        case "P9":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/windriver/index.html");
                            break;

                        case "P10":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/flexerasoftware/index.html");
                            break;

                        case "P11-Breezometer":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/breezometer/index.html");
                            break;

                        case "P11-madcap":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/madcap/index.html");
                            break;

                        case "P12":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/kudan/index.html");
                            break;

                        case "P13":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/ispring/index.html");
                            break;

                        case "P14-photomodeler":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/photomodeler/index.html");
                            break;

                        case "P14-bingmaps":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/bing_maps/index.html");
                            break;

                        case "P14-pcdoctor":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/pc_doctor/index.html");
                            break;

                        case "P15-axure":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/axure/index.html");
                            break;

                        case "P15-justinmind":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/justinmind/index.html");
                            break;

                        case "P15-XMLSpy":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/altova/index.html");
                            break;

                        case "P15-sourceinsight":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/sourceinsight/index.html");
                            break;

                        case "P16-jprofiler":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/ejtechnologies/index.html");
                            break;

                        case "P16-treegrid":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/treegrid/index.html");
                            break;

                        case "P17-orpalis":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/orpalis/index.html");
                            break;

                        case "P17-itext":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/itext/index.html");
                            break;

                        case "P17-vicuesoft":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/vicuesoft/index.html");
                            break;

                        case "P18-arction":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/arction/index.html");
                            break;

                        case "P18-igniteui":
                            Application.OpenURL("https://jp.infragistics.com/products/ignite-ui");
                            break;

                        case "P19":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/bcl_tech/index.html");
                            break;

                        case "P20":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/spreadsheetgear/index.html");
                            break;

                        case "P21":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/activepdf/index.html");
                            break;

                        case "P22":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/accusoft/index.html");
                            break;

                        case "P23":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/aspose/index.html");
                            break;

                        case "P24":
                            Application.OpenURL("https://www.xlsoft.com/jp/products/smartbear/index.html");
                            break;
                        }
                    }
                }
            }
        }