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; } }
// Start is called before the first frame update void Start() { anchorManager = FindObjectOfType <AnchorManager>(); aRAnchorManager = FindObjectOfType <ARAnchorManager>(); distanceText = GetComponent <TMP_Text>(); distanceText.text = ""; }
void Awake() { _raycastManager = GetComponent <ARRaycastManager>(); _anchorManager = GetComponent <ARAnchorManager>(); _anchorManager.anchorsChanged += OnAnchorsChanged; }
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); }
// Start is called before the first frame update void Start() { navigationManager = GetComponent <NavigationManager>(); arTrackedImageManager = GetComponent <ARTrackedImageManager>(); aRAnchorManager = GetComponent <ARAnchorManager>(); aRTapToPlace = GetComponent <ARTapToPlace>(); }
// Use this for initialization void Awake() { m_anchorManager = this.transform.GetComponent <ARAnchorManager>(); m_RaycastManager = this.transform.GetComponent <ARRaycastManager>(); deltaRotation = Quaternion.identity; lastHitPoseRotation = Quaternion.identity; }
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; /// /// void HostCloudAnchor(Pose pose) /// { /// // Create a local anchor, you may also use another ARAnchor you already have. /// ARAnchor localAnchor = AnchorManager.AddAnchor(pose); /// /// // Request the Cloud Anchor. /// _cloudAnchor = AnchorManager.HostCloudAnchor(localAnchor); /// } /// /// 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); }
// 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)); }
public void Cleanup(ARAnchorManager arAnchorManager) { if ((arAnchorManager != null) && (arAnchor != null)) { arAnchorManager.RemoveAnchor(arAnchor); arAnchor = null; } }
private void Start() { inside = false; created = false; SetMaterials(false); augmentationManager = augmentationCenter.GetComponent <AugmentationManager>(); anchorManager = FindObjectOfType <ARAnchorManager>(); }
/// <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); }
// 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"); }
// 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; } }
// 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); }
void Awake() { if (ARController.Instance == null) { return; // shouldn't happen } manager = ARController.Instance.GetComponentInChildren <ARAnchorManager>(); manager.anchorsChanged += OnAnchorsChanged; Anchor = GetComponent <ARAnchor>(); }
void Awake() { session = FindObjectOfType <ARSession>(); sessionGameObject = session.gameObject; sessionOrigin = FindObjectOfType <ARSessionOrigin>(); planeManager = GetComponent <ARPlaneManager>(); pointCloudManager = GetComponent <ARPointCloudManager>(); rayManager = GetComponent <ARRaycastManager>(); anchorManager = GetComponent <ARAnchorManager>(); }
// 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); }
// 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>(); }
// 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; }
void Awake() { arRaycastManager = GetComponent <ARRaycastManager>(); arReferencePointManager = GetComponent <ARAnchorManager>(); arPlaneManager = GetComponent <ARPlaneManager>(); toggleButton.onClick.AddListener(TogglePlaneDetection); clearReferencePointsButton.onClick.AddListener(ClearReferencePoints); debugLog.gameObject.SetActive(false); }
// 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; }
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()); } }
// 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; }