Beispiel #1
0
        // Use this for initialization
        void Start()
        {
            planSnapManager = FindObjectOfType <PlanSnapManager>();
            sheetSprite     = GetComponentInChildren <SpriteRenderer>(true);

            //for hiding the picture ofthe sheet where there will be a real sheet.
            if (showSheetSprite)
            {
                sheetSprite.enabled = true;
            }
            else
            {
                sheetSprite.enabled = false;
            }

            //subscribe to ARKit image events
#if UNITY_IOS
            try
            {
                UnityARSessionNativeInterface.ARImageAnchorAddedEvent   += AddImageAnchor;
                UnityARSessionNativeInterface.ARImageAnchorUpdatedEvent += UpdateImageAnchor;
                UnityARSessionNativeInterface.ARImageAnchorRemovedEvent += RemoveImageAnchor;
            }
            catch (System.Exception)
            {
                Debug.LogWarning("Failed to subscribe to ARKit image events. " +
                                 "Is your build target set? Have you imported and uptodate Unity ARKit Plugin?");
                throw;
            }
#endif

            RemoveAnchor();
        }
Beispiel #2
0
        //set the position of the object manager according to the marker location
        public void PositionObjectManager()
        {
            //in case this is running not in runtime, grab the stuff
            if (!planSnapManager)
            {
                planSnapManager = FindObjectOfType <PlanSnapManager>();
            }

            planSnapManager.objectManager.transform.position = transform.position;
            planSnapManager.objectManager.transform.RotateAround(transform.position, Vector3.up,
                                                                 transform.rotation.eulerAngles.y - planSnapManager.objectManager.transform.rotation.eulerAngles.y);
            Debug.Log("Parent Euler angles: " + transform.rotation.eulerAngles.ToString());
            Debug.Log("objectmanager euler angles: " + planSnapManager.objectManager.transform.rotation.eulerAngles.ToString());
        }