private void OnApplicationFocus(bool hasFocus)
    {
        // Debug.Log("2 Application Focus: "+hasFocus);
        aRSession.Reset();

        if (hasFocus)
        {
            aRSession.enabled = true;
            // Debug.Log("4 Enable AR Session");
        }
    }
        public void PowerOff()
        {
            AutoFocusRequested      = false;
            arCamera.enabled        = false;
            EnabledPositionTracking = false;
            EnabledImageTracking    = false;
            arTrackedImageEventManager.Clear();

            Observable.Timer(TimeSpan.FromMilliseconds(300))
            .Do(_ => _arSession.Reset())
            .Delay(TimeSpan.FromMilliseconds(300))
            .Subscribe(_ => _arSession.enabled = false);
        }
示例#3
0
 void OnApplicationPause(bool pauseStatus)
 {
     if (!pauseStatus)
     {
         session.Reset();
     }
 }
示例#4
0
    // UI logic
    public void ResetSession()
    {
        if (waterGameObject != null)
        {
            Destroy(waterGameObject);
        }

        // Destroy the placed objects if any
        for (int i = 0; i < listOfPlacedObjects.Count; i++)
        {
            Destroy(listOfPlacedObjects[i].gameObject);
        }
        listOfPlacedObjects.Clear();

        // Destroy the gameobjects holding the wall meshes
        for (int i = 0; i < listOfWallMeshes.Count; i++)
        {
            Destroy(listOfWallMeshes[i].gameObject);
        }
        listOfWallMeshes.Clear();

        for (int i = 0; i < listOfLinerenderers.Count; i++)
        {
            Destroy(listOfLinerenderers[i].gameObject);
        }
        listOfLinerenderers.Clear();

        HasSavedPoint = false;
        elevation     = 0.0f;
        arSession.Reset();
        Debug.Log("Session reset");
    }
示例#5
0
 public void ARReset()
 {
     aRSession.Reset();
     fieldSet            = false;
     fieldScale.value    = 1;
     fieldAltitude.value = 1;
 }
    // Start is called before the first frame update
    void Start()
    {
        // Save a reference to the ARTapToPlaceObject component as our singleton instance
        Instance = this;

        arManager = FindObjectOfType <ARRaycastManager>();
        Debug.Log("arManager: " + arManager.ToString());

        arCamera = FindObjectOfType <ARSessionOrigin>().camera;
        Debug.Log("arCamera: " + arCamera.ToString());

        arSession = FindObjectOfType <ARSession>();
        Debug.Log("arSession: " + arSession.ToString());

        // Assign prefab in insepctor and place object with button click event
        if (placeObjectButton != null && objectToPlace != null)
        {
            placeObjectButton.onClick.AddListener(() =>
            {
                spawnedObject = Instantiate(objectToPlace, placementPose.position, placementPose.rotation);
            });
        }

        // Assign prefab in insepctor and place object with button click event
        if (destoryAllObjectButton != null)
        {
            destoryAllObjectButton.onClick.AddListener(() =>
            {
                SceneManager.LoadScene("ARScene");
                arSession.Reset();
            });
        }
    }
示例#7
0
    public void CoachingInProgress()
    {
        DisableControls.Raise();
        myARSession.Reset();

#if UNITY_IOS
        myARSession.GetComponent <ARKitCoachingOverlay>().ActivateCoaching(true);
#endif
    }
 public void RestartSession()
 {
     //restarts ARSession -- clears current objects... maintains settings from backend
     //needs to put helicopter back in front of camera as though it is at attached cam movepoint
     AudioManager.instance.ClickSound();
     aRSession.Reset();
     PlaneObjectData.singleton.DestroyCurrentEnvironment();
     remoteHeliMove.ResetRemotePoint();
 }
示例#9
0
        /// <summary>
        /// Button press for reset confirmation
        /// </summary>
        public void OnRestartGameClick()
        {
            AudioManager.Instance.PlayAudioClip("Reset");

            GameManager.Instance.RestartGame();
            arSession.Reset();

            UXManager.Instance.GoToSection(SectionType.Scan);
        }
示例#10
0
    public void GoTo2D()
    {
        m_ARSession.Reset();

        btn_AddAlways.SetActive(false);

        int countActiveGO;

        countActiveGO = 0;

        zaborActive = false;

        BG.SetActive(true);
        generalMenu.SetActive(true);
        TopMenu.SetActive(true);
        DownMenu.SetActive(true);

        for (int i = 0; i < ITMC.Length; i++)
        {
            if (ITMC[i].activeSelf)
            {
                countActiveGO += i;
            }
        }

        if (!activeInfoMenu && countActiveGO > 0 || ITMC[0].activeSelf)
        {
            InfoTitleMenu.SetActive(true);
            activeInfoMenu = true;
        }

        CartMenu.SetActive(false);

        btn_AR.SetActive(true);
        btn_2D.SetActive(false);
        btn_AR_Zabor.SetActive(false);
        SlideMenu.SetActive(false);
        FilterMenu.SetActive(false);
        _AR.SetActive(false);
        _2D.SetActive(true);

        if (_PlaceOnPlane.NumberItemMenu >= 4)
        {
            float viewContent = 75f * _PlaceOnPlane.NumberItemMenu;
            go_c_DWC_2D.transform.rectTransform().localPosition = new Vector3(-viewContent, go_c_DWC_2D.transform.rectTransform().localPosition.y, go_c_DWC_2D.transform.rectTransform().localPosition.z);
        }

        go_c_DWC_AR.transform.rectTransform().localPosition = Vector3.zero;


        GameObject[] gosPFD;
        gosPFD = GameObject.FindGameObjectsWithTag("ARPlacedPlaneForDot");
        foreach (GameObject goPFD in gosPFD)
        {
            Destroy(goPFD);
        }
    }
示例#11
0
 public void reset()
 {
     arSession.Reset();
     if (UIPanel.activeInHierarchy == false)
     {
         UIPanel.SetActive(true);
     }
     foreach (Transform child in wall.transform)
     {
         GameObject.Destroy(child.gameObject);
     }
 }
    void ApplyWorldMap(ARWorldMap arWorldMap)
    {
        arSession.Reset();

        if (!(arSession.subsystem is ARKitSessionSubsystem arKitSessionSubsystem))
        {
            throw new Exception("No session subsystem available. Could not load.");
        }
        if (!arWorldMap.valid)
        {
            throw new Exception("Data is not a valid ARWorldMap");
        }
        arKitSessionSubsystem.ApplyWorldMap(arWorldMap);
    }
    void ConfigureSession()
    {
        mSession.Reset();

        /*
         #if !UNITY_EDITOR
         *      ARKitWorldTrackingSessionConfiguration config = new ARKitWorldTrackingSessionConfiguration ();
         *      config.planeDetection = UnityARPlaneDetection.None;
         *      config.alignment = UnityARAlignment.UnityARAlignmentGravity;
         *      config.getPointCloudData = true;
         *      config.enableLightEstimation = true;
         *      mSession.RunWithConfig (config);
         #endif
         */
    }
示例#14
0
    /* Reset ar scene */
    public async void Reset()
    {
        Clear();
        ARToolPanel.Mode = ARTool.Loader;
        adding           = false;
        SelectedModel    = null;
        ARSession.Reset();
        PlaneIcon.Reset();
        PlaneIcon.On = true;
        ARView.LockIcons(true);
        await planeSelector();

        showSelected();
        unlockBack();
    }
示例#15
0
    public void ResetARTracking()
    {
        arSession.Reset();

        // disable the environment
        experienceEnvironment.SetActive(false);

        // bring tracking visuals
        aRPointCloudManager.enabled = true;
        aRPlaneManager.enabled      = true;
        totemPlacer.enabled         = true;

        foreach (var particle in aRPointCloudManager.trackables)
        {
            particle.gameObject.SetActive(true);
        }

        onExperienceReset?.Invoke();
    }
    void ConfigureSession()
    {
        mSession.Reset();

        /*
         #if !UNITY_EDITOR
         *      ARKitWorldTrackingSessionConfiguration config = new ARKitWorldTrackingSessionConfiguration ();
         *
         *      if (UnityARSessionNativeInterface.IsARKit_1_5_Supported ()) {
         *              config.planeDetection = UnityARPlaneDetection.HorizontalAndVertical;
         *      } else {
         *              config.planeDetection = UnityARPlaneDetection.Horizontal;
         *      }
         *
         *      config.alignment = UnityARAlignment.UnityARAlignmentGravity;
         *      config.getPointCloudData = true;
         *      config.enableLightEstimation = true;
         *      mSession.RunWithConfig (config);
         #endif
         */
    }
示例#17
0
    public void RemovePlanes()
    {
        // Possibility 1: Reset AR Session and display message
        portalManager.DestroyPortal();

        // Destroy all currently detected planes manually, after that reset the session
        foreach (var plane in planeManager.trackables)
        {
            plane.gameObject.SetActive(false);
        }
        session.Reset();

        // Display message
        textManager.ShowNotification(TextContent.everythingCleared);

        // Possibility 2: Reset all parts of the app
        // Delete current possible existing portals
        //portalManager.DestroyPortal();

        //// Destroy all currently detected planes manually, after that reset the session
        //foreach (var plane in planeManager.trackables)
        //{
        //    Debug.Log("plane deleted");
        //    plane.gameObject.SetActive(false);
        //}
        //session.Reset();

        //// Restart the onboarding
        //onboardingManager.StartCoroutine("Onboarding");

        //// Disable all buttons until the onboarding is complete
        //buttonDisplayment.StartCoroutine("Start");

        //// Stop the door detection until the onboarding is complete
        //// NOTE: doorDetection Stop function was removed
        //doorDetection.Stop();
        //doorDetection.StartCoroutine("Start");

        //Debug.Log("Successful reset");
    }
示例#18
0
    private void OnEnable()
    {
        _view.CloseTapped   += OnBackTapped;
        _view.PauseTapped   += OnPauseTapped;
        _view.UnPauseTapped += OnUnPauseTapped;

        _istantiator.Instantiaded += OnInstantiated;

        _planeStateReporter.PlaneDetected += OnPlaneDetected;

        var director = FindObjectOfType <PlayableDirector>();

        _session.Reset();

#if !UNITY_EDITOR
        _view.ActivateUI(false);
#endif
        _planeManager.enabled        = true;
        _timelineController.Director = director;

        _view.ActivateUI(false);
    }
示例#19
0
 void Start()
 {
     Debug.Log("Scene started: " + SceneManager.GetActiveScene().name);
     if (arSession != null)
     {
         arSession.Reset();
         Debug.Log("arSession Reset");
     }
     hasExtra = false;
     try
     {
         UnityPlayer      = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
         currentActivitty = UnityPlayer.GetStatic <AndroidJavaObject>("currentActivity");
         intent           = currentActivitty.Call <AndroidJavaObject>("getIntent");
         hasExtra         = intent.Call <bool>("hasExtra", "sceneName");
         Debug.Log("hasExtra: " + hasExtra);
     }
     catch
     {
         Debug.Log("hasExtra - catch: " + false);
     }
 }
示例#20
0
    IEnumerator DoReload()
    {
        session.Reset();
        Destroy(session.gameObject);
        yield return(null);

        if (sessionPrefab != null)
        {
            session = Instantiate(sessionPrefab).GetComponent <ARSession>();
            Debug.LogWarning("Sesion reloaded");
            session.Reset();
            if (null != placer && null != placer.spawnedObjects)
            {
                foreach (var obj in placer.spawnedObjects)
                {
                    GameObject.Destroy(obj.gameObject);
                }
            }
            // Hook the buttons back up
            pauseButton.onClick.AddListener(() => { session.enabled = false; });
            resumeButton.onClick.AddListener(() => { session.enabled = true; });
        }
    }
示例#21
0
    // UI logic
    public void ResetSession()
    {
        if (waterGameObject != null)
        {
            Destroy(waterGameObject);
        }

        // Destroy the placed objects if any
        for (int i = 0; i < listOfPlacedObjects.Count; i++)
        {
            Destroy(listOfPlacedObjects[i].gameObject);
        }
        listOfPlacedObjects.Clear();

        // Destroy the gameobjects holding the wall meshes
        for (int i = 0; i < listOfWallMeshes.Count; i++)
        {
            Destroy(listOfWallMeshes[i].gameObject);
        }
        listOfWallMeshes.Clear();

        for (int i = 0; i < listOfLinerenderers.Count; i++)
        {
            Destroy(listOfLinerenderers[i].gameObject);
        }
        listOfLinerenderers.Clear();

        // Reset variables
        waterIsVisible                = false;
        adjustRadiusSlider.value      = 0;
        multiplyElevationSlider.value = 0;
        HasSavedPoint = false;
        elevation     = 0.0f;
        arSession.Reset();
        Debug.Log("Session reset");
    }
    private void sceneLoading(int inpInt)
    {
        if (scene == 0)
        {
            if (inpInt != 0)
            {
                scene = inpInt;
                mainCamera.SetActive(false);
                arsession.SetActive(true);
                ARSession arses = arsession.GetComponent <ARSession>();
                arses.Reset();
                SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive);
            }

            Debug.Log("sceneLoading" + scene);
        }
        else
        {
            mainCamera.SetActive(true);
            sceneElementDestory(scene);
            scene = 0;
            Debug.Log("gotoHome " + scene);
        }
    }
示例#23
0
 public void ResetSession()
 {
     arSession.Reset();
 }
 public void Reset(Action callback)
 {
     arSession.Reset();
     onAfterReset += callback;
 }
 /// <summary>
 /// Reset the <c>ARSession</c>, destroying any existing trackables,
 /// such as planes. Upon loading a saved <c>ARWorldMap</c>, saved
 /// trackables will be restored.
 /// </summary>
 public void OnResetButton()
 {
     m_ARSession.Reset();
 }
示例#26
0
 public void ResetARSession() => m_arSession.Reset();
示例#27
0
 public void ResetSession()
 {
     m_ARSession.Reset();
 }
示例#28
0
    // Start is called before the first frame update
    void Start()
    {
        // Save a reference to the ARTapToPlaceObject component as our singleton instance
        Instance = this;

        arManager = FindObjectOfType <ARRaycastManager>();
        Debug.Log("arManager: " + arManager.ToString());

        arCamera = FindObjectOfType <ARSessionOrigin>().camera;
        Debug.Log("arCamera: " + arCamera.ToString());

        arSession = FindObjectOfType <ARSession>();
        Debug.Log("arSession: " + arSession.ToString());

        // Assign prefab in insepctor and place object with button click event
        if (placeObjectButton != null && objectToPlace != null)
        {
            placeObjectButton.onClick.AddListener(() =>
            {
                dominos.Add(Instantiate(objectToPlace, placementPose.position, placementPose.rotation));
            });
        }

        // Assign prefab in insepctor and place object with button click event
        if (pushDominoButton != null && objectToPlace != null)
        {
            pushDominoButton.onClick.AddListener(() =>
            {
                if (dominos.Count > 0)
                {
                    GameObject firstDomino = dominos[0];
                    Debug.Log("firstDomino: " + firstDomino.ToString());

                    Vector3 direction = firstDomino.transform.position - transform.position;
                    //firstDomino.GetComponent<Rigidbody>().AddForceAtPosition(direction.normalized, transform.position);
                    Debug.Log("rigidbody: " + firstDomino.GetComponentInChildren <Rigidbody>());

                    var cameraForward = arCamera.GetComponent <Camera>().transform.forward;
                    var cameraBearing = new Vector3(cameraForward.x, 0, 0).normalized;
                    firstDomino.GetComponentInChildren <Rigidbody>().AddForce(cameraBearing * force);
                }
            });
        }

        // Assign prefab in insepctor and place object with button click event
        if (increaseForceButton != null)
        {
            increaseForceButton.onClick.AddListener(() =>
            {
                force         += 5;
                forceText.text = force.ToString();
            });
        }

        // Assign prefab in insepctor and place object with button click event
        if (decreaseForceButton != null)
        {
            decreaseForceButton.onClick.AddListener(() =>
            {
                force         -= 5;
                forceText.text = force.ToString();
            });
        }

        // Assign prefab in insepctor and place object with button click event
        if (destoryAllObjectButton != null)
        {
            destoryAllObjectButton.onClick.AddListener(() =>
            {
                Destroy(GameObject.FindWithTag("Dominos"));
                dominos.Clear();

                arSession.Reset();
            });
        }
    }
示例#29
0
 public void Restart()
 {
     arSession.Reset();
     SceneManager.LoadScene(0);
 }
示例#30
0
    public void resetARView()
    {
        ARSession arSession = ARSession.GetComponent <ARSession>();

        arSession.Reset();
    }