Exemple #1
0
        public InsightARUserHitAnchor GetHitTestResult(float pointX, float pointY)
        {
            InsightARUserHitAnchor anchor = new InsightARUserHitAnchor()
            {
                identifier = "",
                position   = Vector3.zero,
                isValid    = 0,
            };

                        #if UNITY_ANDROID || UNITY_IOS
            if (CurrentState != InsightARState.Tracking)
            {
                return(anchor);
            }
            InsightARVector2 poi = new InsightARVector2();
                        #if UNITY_ANDROID
            if (InsightARNative.isUseHWAR())
            {
                poi.y = Screen.height * pointY;
                poi.x = Screen.width * pointX;
            }
            else
                        #endif
            {
                var screenPosition = Camera.main.ScreenToViewportPoint(new Vector3(pointX, pointY, 0f));
                poi.x = screenPosition.x;
                poi.y = screenPosition.y;
            }
            InsightARAnchorData anchorData = InsightARNative.iarGetLastHitTestResult(poi);
            anchor = InsightARUtility.GetUserHitAnchorFromAnchorData(anchorData);
                        #endif
            return(anchor);
        }