Пример #1
0
 void Start()
 {
     // Get references to nessasary components and game objects
     anchorManager  = GameObject.Find("AR Session Origin").GetComponent <ARAnchorManager>();
     raycastManager = GameObject.Find("AR Session Origin").GetComponent <ARRaycastManager>();
     sessionOrigin  = GameObject.Find("AR Session Origin");
 }
        void AttachRefrences()
        {
            if (m_ARSession == null)
            {
                m_ARSession = FindObjectOfType <ARSession>();
            }

            if (m_SessionOrigin == null)
            {
                m_SessionOrigin = FindObjectOfType <ARSessionOrigin>();
            }

            if (m_AnchorManager == null)
            {
                m_AnchorManager = FindObjectOfType <ARAnchorManager>();
                if (m_AnchorManager == null && m_SessionOrigin != null)
                {
                    m_AnchorManager = m_SessionOrigin.gameObject.AddComponent <ARAnchorManager>();
                }
            }

            if (m_MarkerController == null)
            {
                m_MarkerController = FindObjectOfType <MarkerController>();
                m_MarkerController.MarkerAnchorer = this;
            }
        }
Пример #3
0
 // Start is called before the first frame update
 void Start()
 {
     anchorManager     = FindObjectOfType <AnchorManager>();
     aRAnchorManager   = FindObjectOfType <ARAnchorManager>();
     distanceText      = GetComponent <TMP_Text>();
     distanceText.text = "";
 }
Пример #4
0
    void Awake()
    {
        _raycastManager = GetComponent <ARRaycastManager>();
        _anchorManager  = GetComponent <ARAnchorManager>();

        _anchorManager.anchorsChanged += OnAnchorsChanged;
    }
Пример #5
0
 public VirtualObjectsStore(ARAnchorManager anchorManager, Logger logger)
 {
     this.objectsData = new Dictionary <string, VirtualObjectData>();
     this.reversedGameObjectsToDataMapping = new Dictionary <int, string>();
     this.anchorManager = anchorManager;
     this.logger        = logger;
 }
    void Awake()
    {
        arReferencePointManager = GetComponent <ARAnchorManager>();
        clearReferencePointsButton.onClick.AddListener(ClearReferencePoints);

        debugLog.gameObject.SetActive(false);
    }
Пример #7
0
 // Start is called before the first frame update
 void Start()
 {
     navigationManager     = GetComponent <NavigationManager>();
     arTrackedImageManager = GetComponent <ARTrackedImageManager>();
     aRAnchorManager       = GetComponent <ARAnchorManager>();
     aRTapToPlace          = GetComponent <ARTapToPlace>();
 }
Пример #8
0
 // Use this for initialization
 void Awake()
 {
     m_anchorManager     = this.transform.GetComponent <ARAnchorManager>();
     m_RaycastManager    = this.transform.GetComponent <ARRaycastManager>();
     deltaRotation       = Quaternion.identity;
     lastHitPoseRotation = Quaternion.identity;
 }
Пример #9
0
 void Start()
 {
     arRaycastManager = FindObjectOfType <ARRaycastManager>();
     cursorScript     = FindObjectOfType <ELC_CursorProperties>();
     handScript       = FindObjectOfType <ELC_hand>();
     AnchorManager    = FindObjectOfType <ARAnchorManager>();
 }
        /// <summary>
        /// Creates a new Cloud Anchor using an existing local ARAnchor.
        /// <example>
        /// The sample code below illustrates how to host a Cloud Anchor.
        /// <pre>
        /// <code>
        /// private ARCloudAnchor _cloudAnchor;
        /// &nbsp;
        /// void HostCloudAnchor(Pose pose)
        /// {
        ///     // Create a local anchor, you may also use another ARAnchor you already have.
        ///     ARAnchor localAnchor = AnchorManager.AddAnchor(pose);
        /// &nbsp;
        ///     // Request the Cloud Anchor.
        ///     _cloudAnchor = AnchorManager.HostCloudAnchor(localAnchor);
        /// }
        /// &nbsp;
        /// void Update()
        /// {
        ///     if (_cloudAnchor)
        ///     {
        ///         // Check the Cloud Anchor state.
        ///         CloudAnchorState cloudAnchorState = _cloudAnchor.cloudAnchorState;
        ///         if (cloudAnchorState == CloudAnchorState.Success)
        ///         {
        ///             myOtherGameObject.transform.SetParent(_cloudAnchor.transform, false);
        ///             _cloudAnchor = null;
        ///         }
        ///         else if (cloudAnchorState == CloudAnchorState.TaskInProgress)
        ///         {
        ///             // Wait, not ready yet.
        ///         }
        ///         else
        ///         {
        ///             // An error has occurred.
        ///         }
        ///     }
        /// }
        /// </code>
        /// </pre>
        /// </example>
        /// </summary>
        /// <param name="anchorManager">The ARAnchorManager instance.</param>
        /// <param name="anchor">The local <c>ARAnchor</c> to be used as the
        /// basis to host a new Cloud Anchor.</param>
        /// <returns>If successful, a <c><see cref="ARCloudAnchor"/></c>,
        /// otherwise <c>null</c>.</returns>
        public static ARCloudAnchor HostCloudAnchor(
            this ARAnchorManager anchorManager, ARAnchor anchor)
        {
            // Create the underlying ARCore Cloud Anchor.
            IntPtr cloudAnchorHandle = SessionApi.HostCloudAnchor(
                ARCoreExtensions._instance.currentARCoreSessionHandle,
                anchor.AnchorHandle());

            if (cloudAnchorHandle == IntPtr.Zero)
            {
                return(null);
            }

            // Create the GameObject that is the Cloud Anchor.
            ARCloudAnchor cloudAnchor =
                (new GameObject(_gameObjectName)).AddComponent <ARCloudAnchor>();

            if (cloudAnchor)
            {
                cloudAnchor.SetAnchorHandle(cloudAnchorHandle);
            }

            // Parent the new Cloud Anchor to the session origin.
            cloudAnchor.transform.SetParent(
                ARCoreExtensions._instance.SessionOrigin.trackablesParent, false);

            return(cloudAnchor);
        }
        /// <summary>
        /// Set the token to use when authenticating with the ARCore Cloud Anchor service
        /// on the iOS platform.  This should be called each time the application's
        /// token is refreshed.
        /// </summary>
        /// <param name="anchorManager">The ARAnchorManager instance.</param>
        /// <param name="authToken">The authentication token to set.</param>
        public static void SetAuthToken(this ARAnchorManager anchorManager, string authToken)
        {
            // Only iOS needs AuthToken for Cloud Anchor persistence.
#if ARCORE_EXTENSIONS_IOS_SUPPORT && UNITY_IOS
            if (!string.IsNullOrEmpty(RuntimeConfig.Instance.IOSCloudServicesApiKey))
            {
                Debug.LogError(
                    "Cannot set token in applications built using the 'API Key' " +
                    "authentication strategy. To use it, check Edit > Project Settings " +
                    "> XR > ARCore Extensions > iOS Support Enabled and " +
                    "set iOS Authentication Strategy to Authentication Token.");
                return;
            }

            if (string.IsNullOrEmpty(authToken))
            {
                Debug.LogError("Cannot set empty token in applications.");
                return;
            }

            SessionApi.SetAuthToken(
                ARCoreExtensions._instance.currentARCoreSessionHandle, authToken);
#else
            Debug.LogError("AuthToken only works with iOS Supported enabled in " +
                           "ARCore Extensions Project Settings and the target platform has set to iOS.");
#endif // ARCORE_IOS_SUPPORT && UNITY_IOS
        }
        public static ARCloudReferencePoint ResolveCloudReferenceId(
            this ARAnchorManager referencePointManager,
            string cloudReferenceId)
        {
            // Create the underlying ARCore Cloud Anchor.
            IntPtr cloudAnchorHandle = SessionApi.ResolveCloudAnchor(
                ARCoreExtensions._instance.currentARCoreSessionHandle,
                cloudReferenceId);

            if (cloudAnchorHandle == IntPtr.Zero)
            {
                return(null);
            }

            // Create the GameObject that is the cloud reference point.
            ARCloudReferencePoint cloudReferencePoint =
                (new GameObject(_gameObjectName)).AddComponent <ARCloudReferencePoint>();

            if (cloudReferencePoint)
            {
                cloudReferencePoint.SetAnchorHandle(cloudAnchorHandle);
            }

            // Parent the new cloud reference point to the session origin.
            cloudReferencePoint.transform.SetParent(
                ARCoreExtensions._instance.SessionOrigin.trackablesParent, false);

            return(cloudReferencePoint);
        }
Пример #13
0
    // Start is called before the first frame update
    async void Start()
    {
        //have to Task Delay at the start in order to give ARSession time to set up properly
        await Task.Delay(3000);

        spatialAnchorManager = GetComponent <SpatialAnchorManager>();
        aRAnchorManager      = FindObjectOfType <ARAnchorManager>();

        //if the session doesn't exist, create session
        if (spatialAnchorManager.Session == null)
        {
            await spatialAnchorManager.CreateSessionAsync();
        }
        //add AnchorLocated event so when the session detects an anchor, it does what we want it to
        spatialAnchorManager.AnchorLocated += CloudAnchorManager_AnchorLocated;
        debugText.text = "\nSession Created";

        //begin the session
        await spatialAnchorManager.StartSessionAsync();

        //request the sesnsor permissions for wifi and geolocation -- then configure
        requestSensorPermissions();
        configureSensors();
        debugText.text += "\nSession Started";
        debugText.text += "\nID: " + spatialAnchorManager.SpatialAnchorsAccountId;
        debugText.text += "\nKey: " + spatialAnchorManager.SpatialAnchorsAccountKey;
    }
    private void Awake()
    {
        anchormanager = GetComponent <ARAnchorManager>();


        createAnchorEvents = new createAnchorEvents();
        createAnchorEvents.AddListener((t) => ARPlacementManager.Instance.ReCreatePlacement(t));
    }
Пример #15
0
 public void Cleanup(ARAnchorManager arAnchorManager)
 {
     if ((arAnchorManager != null) && (arAnchor != null))
     {
         arAnchorManager.RemoveAnchor(arAnchor);
         arAnchor = null;
     }
 }
Пример #16
0
    private void Start()
    {
        inside  = false;
        created = false;

        SetMaterials(false);
        augmentationManager = augmentationCenter.GetComponent <AugmentationManager>();
        anchorManager       = FindObjectOfType <ARAnchorManager>();
    }
Пример #17
0
 /// <summary>
 /// The Unity Awake() method.
 /// </summary>
 public void Awake()
 {
     _cloudAnchorsExampleController =
         GameObject.Find("CloudAnchorsExampleController")
         .GetComponent <CloudAnchorsExampleController>();
     _anchorManager = _cloudAnchorsExampleController.AnchorManager;
     _anchorMesh    = transform.Find("AnchorMesh").gameObject;
     _anchorMesh.SetActive(false);
 }
Пример #18
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject arSessionOrigin = GameObject.Find("AR Session Origin");

        this.gameState      = GameObject.Find("GameState").GetComponent <GameState>();
        this.anchorManager  = arSessionOrigin.GetComponent <ARAnchorManager>();
        this.raycastManager = arSessionOrigin.GetComponent <ARRaycastManager>();
        this.playerCamera   = GameObject.Find("AR Camera");
    }
Пример #19
0
    // Start is called before the first frame update
    private void Start()
    {
        _rigidbody = GetComponent <Rigidbody>();

        _raycastManager = FindObjectOfType <ARRaycastManager>();
        Debug.Assert(_raycastManager);

        _anchorManager = FindObjectOfType <ARAnchorManager>();
        Debug.Assert(_anchorManager);
    }
 void Awake()
 {
     aRRaycastManager      = GetComponent <ARRaycastManager>();
     referencePointManager = GetComponent <ARAnchorManager>();
     planeManager          = GetComponent <ARPlaneManager>();
     if (referencePointManager.anchorPrefab.gameObject != null)
     {
         FindObjectOfType <PlacementIndicator>().gameObject.transform.GetChild(0).localScale = referencePointManager.anchorPrefab.gameObject.transform.localScale;
     }
 }
Пример #21
0
    // Start is called before the first frame update
    void Start()
    {
        spatialAnchorManager = GetComponent <SpatialAnchorManager>();
        ARSession aRSession = FindObjectOfType <ARSession>();

        aRAnchorManager         = FindObjectOfType <ARAnchorManager>();
        anchorManager           = FindObjectOfType <AnchorManager>();
        ARSession.stateChanged += AnchorConverter_SessionStateChange;
        tutorialManager.gameObject.SetActive(true);
    }
Пример #22
0
        void Awake()
        {
            if (ARController.Instance == null)
            {
                return; // shouldn't happen
            }

            manager = ARController.Instance.GetComponentInChildren <ARAnchorManager>();
            manager.anchorsChanged += OnAnchorsChanged;
            Anchor = GetComponent <ARAnchor>();
        }
Пример #23
0
    void Awake()
    {
        session           = FindObjectOfType <ARSession>();
        sessionGameObject = session.gameObject;

        sessionOrigin     = FindObjectOfType <ARSessionOrigin>();
        planeManager      = GetComponent <ARPlaneManager>();
        pointCloudManager = GetComponent <ARPointCloudManager>();
        rayManager        = GetComponent <ARRaycastManager>();
        anchorManager     = GetComponent <ARAnchorManager>();
    }
Пример #24
0
 // Start is called before the first frame update
 void Start()
 {
     Debug.Log("Anchor Asset started");
     if (_anchor == null)
     {
         _anchor = GetComponent <ARAnchor>();
     }
     _anchorManager = FindObjectOfType <ARAnchorManager>();
     _database      = FindObjectOfType <Database>();
     _database.GetData(DatabaseLoaded);
 }
Пример #25
0
 // Start is called before the first frame update
 void Start()
 {
     anchorConverter  = FindObjectOfType <AnchorConverter>();
     aRRaycastManager = GetComponent <ARRaycastManager>();
     aRAnchorManager  = GetComponent <ARAnchorManager>();
     eventSystem      = FindObjectOfType <EventSystem>();
     anchorManager    = FindObjectOfType <AnchorManager>();
     appController    = FindObjectOfType <AppController>();
     materialSwitcher = FindObjectOfType <MaterialSwitcher>();
     anchorLerper     = FindObjectOfType <AnchorLerper>();
 }
Пример #26
0
 // Start is called before the first frame update
 void Start()
 {
     anchorManager  = FindObjectOfType <ARAnchorManager>();
     arPlaneManager = FindObjectOfType <ARPlaneManager>();
     arPlaneManager.requestedDetectionMode = PlaneDetectionMode.None;
     panelStart.SetActive(true);
     panelGenerating.SetActive(false);
     panelGame.SetActive(false);
     panelEnd.SetActive(false);
     currentState = GameState.START;
 }
Пример #27
0
    void Awake()
    {
        arRaycastManager        = GetComponent <ARRaycastManager>();
        arReferencePointManager = GetComponent <ARAnchorManager>();
        arPlaneManager          = GetComponent <ARPlaneManager>();

        toggleButton.onClick.AddListener(TogglePlaneDetection);
        clearReferencePointsButton.onClick.AddListener(ClearReferencePoints);

        debugLog.gameObject.SetActive(false);
    }
Пример #28
0
 // Start is called before the first frame update
 void Start()
 {
     aRRaycastManager          = GetComponent <ARRaycastManager>();
     aRAnchorManager           = GetComponent <ARAnchorManager>();
     indicator                 = Instantiate(placementIndicator);
     currentCloudSpatialAnchor = null;
     aRAnchors                 = new List <ARAnchor>();
     isPlacementValid          = false;
     tryingToUpdate            = false;
     inCreateAnchor            = false;
     movingAnchor              = false;
 }
Пример #29
0
    void Awake()
    {
        _arRaycastManager     = GetComponent <ARRaycastManager>();
        _arAnchorManager      = GetComponent <ARAnchorManager>();
        _arCloudAnchorManager = GetComponent <ARCloudAnchorManager>();
        _arDebugManager       = GetComponent <ARDebugManager>();

        for (int i = 0; i < _arCloudAnchorManager.NUM_OF_ANCHOR; i++)
        {
            placedGameObjectList.Add(new GameObject());
        }
    }
Пример #30
0
 // Start is called before the first frame update
 void Start()
 {
     aRRaycastManager = FindObjectOfType <ARRaycastManager>();
     aRAnchorManager  = FindObjectOfType <ARAnchorManager>();
     indicator        = Instantiate(placementIndicator);
     aRAnchors        = new List <ARAnchor>();
     isPlacementValid = false;
     tryingToUpdate   = false;
     inCreateAnchor   = false;
     movingAnchor     = false;
     selectMode       = false;
 }