/// <summary> /// Start this instance. /// </summary> public override void Start() { m_Sdk = ArwaySDK.Instance; if (string.IsNullOrEmpty(m_Sdk.developerToken)) { NotificationManager.Instance.GenerateError("Invalid Developer Token!"); } ARSpace.SetActive(showContentBeforeLocalization); destinationDropdown.SetActive(showContentBeforeLocalization); // Set max Localization Time to 30 secs if (localizationTimeout > 30f) { localizationTimeout = 30f; } base.Start(); if (!SanityCheckAccessConfiguration()) { return; } feedbackBox.text = stateParams[currentAppState].StepMessage; }
protected override void OnCloudAnchorLocated(AnchorLocatedEventArgs args) { base.OnCloudAnchorLocated(args); if (args.Status == LocateAnchorStatus.Located) { currentCloudAnchor = args.Anchor; UnityDispatcher.InvokeOnAppThread(() => { Pose anchorPose = Pose.identity; #if UNITY_ANDROID || UNITY_IOS anchorPose = currentCloudAnchor.GetPose(); #endif if (AzureAssetImporter.mapIdToOffset.ContainsKey(args.Identifier)) { Vector3 Mapoffsetposition = AzureAssetImporter.mapIdToOffset[args.Identifier].position; Quaternion Mapoffsetrotation = AzureAssetImporter.mapIdToOffset[args.Identifier].rotation; Matrix4x4 cloudMapOffset = Matrix4x4.TRS(Mapoffsetposition, Mapoffsetrotation, Vector3.one); Matrix4x4 anchorPoseOg = Matrix4x4.TRS(anchorPose.position, anchorPose.rotation, Vector3.one); Matrix4x4 resultpose = anchorPoseOg * cloudMapOffset.inverse; loaderPanel.SetActive(false); // localizeButton.SetActive(false); ARSpace.SetActive(true); destinationDropdown.SetActive(true); NotificationManager.Instance.GenerateSuccess("Offset found , setting global pose" + args.Identifier); ARSpace.transform.rotation = resultpose.rotation; ARSpace.transform.position = new Vector3(resultpose[0, 3], resultpose[1, 3], resultpose[2, 3]); } else { ARSpace.SetActive(true); destinationDropdown.SetActive(true); NotificationManager.Instance.GenerateSuccess("No Offset , setting default pose" + args.Identifier); SpawnOrMoveCurrentAnchoredObject(anchorPose.position, anchorPose.rotation); } }); Debug.Log("Yay, anchor located!"); SetBypassCache(true); } }