Ejemplo n.º 1
0
 public TouchDetector(PlaneTouchHandler planeTouchHandler, VirtualObjectTouchHandler virtualObjectTouchHandler,
                      ARRaycastManager arRaycastmanager, Logger logger)
 {
     this.planeTouchHandler         = planeTouchHandler;
     this.virtualObjectTouchHandler = virtualObjectTouchHandler;
     this.arRaycastmanager          = arRaycastmanager;
     this.logger            = logger;
     this.lastTouch         = null;
     this.lastTouchResolved = false;
     GenericState <TouchDetector> .InitState <SNoTouch>(this);
 }
    void Awake()
    {
        arRaycastManager        = GetComponent <ARRaycastManager>();
        arReferencePointManager = GetComponent <ARAnchorManager>();
        arPointCloudManager     = GetComponent <ARPointCloudManager>();

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

        debugLog.gameObject.SetActive(false);
    }
    void Start()
    {
        sessionOrigin  = GetComponent <ARSessionOrigin>();
        hits           = new List <ARRaycastHit>();
        raycastManager = FindObjectOfType <ARRaycastManager>();

        isAlreadyPlaced = false;
        ARBase1.SetActive(false);
        ARBase2.SetActive(false);
        ARBase3.SetActive(false);
        ARBase4.SetActive(false);
    }
Ejemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        arOrigin           = FindObjectOfType <ARSessionOrigin>();
        arRaycastManager   = FindObjectOfType <ARRaycastManager>();
        arPlaneManager     = FindObjectOfType <ARPlaneManager>();
        selectionManager   = FindObjectOfType <SelectionManager>();
        clickToRemoveSound = FindObjectOfType <AudioSource>();
        gameboardGenerator = FindObjectOfType <GameboardGenerator>();

        objectToPlace.tag           = "Selectable";
        objectToPlace.transform.tag = "Selectable";
    }
Ejemplo n.º 5
0
    void Awake()
    {
        m_RaycastManager = GetComponent <ARRaycastManager>();

        if (Application.isEditor)
        {
            for (int i = 0; i < TestingGround.Length; i++)
            {
                TestingGround[i].SetActive(true);
            }
        }
    }
Ejemplo n.º 6
0
    private void Awake()
    {
        RaycastManager = GetComponent <ARRaycastManager>();
        PlaneManager   = GetComponent <ARPlaneManager>();
        SessionOrigin  = GetComponent <ARSessionOrigin>();
        //PointCloudManager = GetComponent<ARPointCloudManager>();

        SetVRPositionButton.gameObject.SetActive(false);
        TransferOwnershipButton.gameObject.SetActive(false);

        MazeManager.SetActive(false);
    }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
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());
        }
    }
Ejemplo n.º 10
0
    void Awake() //初始化
    {
        arRaycastManager = GetComponent <ARRaycastManager>();

        startPoint = Instantiate(measurementPointPrefab, Vector3.zero, Quaternion.identity);
        endPoint   = Instantiate(measurementPointPrefab, Vector3.zero, Quaternion.identity);

        measureLine = GetComponent <LineRenderer>();

        startPoint.SetActive(false);
        endPoint.SetActive(false);
    }
Ejemplo n.º 11
0
    void Start()
    {
        aRRaycastManager = FindObjectOfType <ARRaycastManager>();

        mArPlaneManager.planesChanged += onPlanesChanged;

        mArPointCloudManager.pointCloudsChanged += onPointCloudsChanged;

        ARSession.stateChanged += Change;

        aRCameraManager.frameReceived += onCameraFrameChanged;
    }
Ejemplo n.º 12
0
    void Start()
    {
        this.arRaycastManager = GetComponent <ARRaycastManager>();

        this.objectDetector = goObjectDetector.GetComponent <TinyYolo3Detector>();
        this.objectDetector.Start();

        this.similarWordClient = goSimilarWordClient.GetComponent <SimilarWordClient>();
        this.similarWordClient.Start();

        CalculateShift();
    }
Ejemplo n.º 13
0
    void Awake()
    {
        arRaycastManager = GetComponent <ARRaycastManager>();

        // set initial prefab
        ChangePrefabTo("cube");
        greenButton.onClick.AddListener(() => ChangePrefabTo("sphere"));
        blueButton.onClick.AddListener(() => ChangePrefabTo("cube"));
        redButton.onClick.AddListener(() => ChangePrefabTo("capsule"));
        dismissButton.onClick.AddListener(Dismiss);
        selectSreenButton.onClick.AddListener(OpenSelect);
    }
Ejemplo n.º 14
0
    void Awake()
    {
        arRaycastManager = GetComponent <ARRaycastManager>();
        dismissButton.onClick.AddListener(Dismiss);

        if (redButton != null && greenButton != null && blueButton != null)
        {
            redButton.onClick.AddListener(() => ChangePrefabSelection("ARRed"));
            greenButton.onClick.AddListener(() => ChangePrefabSelection("ARGreen"));
            blueButton.onClick.AddListener(() => ChangePrefabSelection("ARBlue"));
        }
    }
Ejemplo n.º 15
0
 public virtual void awakeInternal()
 {
     m_lineVisualizer              = Instantiate(DistanceVisualizerPrefab, Vector3.zero, Quaternion.identity);
     raycastManager                = ARSessionOrigin.GetComponent <ARRaycastManager>();
     m_lineRenderer                = m_lineVisualizer.GetComponent <LineRenderer>();
     m_lineRenderer.startWidth     = 0.02f;
     m_lineRenderer.endWidth       = 0.02f;
     m_lineRenderer.positionCount  = 0;
     m_lineRenderer.sortingOrder   = 1;
     m_lineRenderer.material       = new Material(Shader.Find("Sprites/Default"));
     m_lineRenderer.material.color = Color.blue;
 }
Ejemplo n.º 16
0
 private void Initialize()
 {
     arRaycastmanager      = GetComponent <ARRaycastManager>();
     virtualObjectsManager = new VirtualObjectsManager(gameObjectToInstantiate, logger);
     materialManager       = new MaterialManager(gameObjectToInstantiate);
     uiControls            = new UIControls();
     controller            = new MasterController(virtualObjectsManager, materialManager, uiControls);
     uiControls.SetController(controller);
     planeTouchHandler         = new PlaneTouchHandler(virtualObjectsManager, controller);
     virtualObjectTouchHandler = new VirtualObjectTouchHandler(virtualObjectsManager, controller);
     touchDetector             = new TouchDetector(planeTouchHandler, virtualObjectTouchHandler, arRaycastmanager, logger);
 }
Ejemplo n.º 17
0
    void Awake()
    {
        arRaycastManager = GetComponent <ARRaycastManager>();

        // set initial prefab
        ChangePrefabTo("ARBlue");

        arGreenButton.onClick.AddListener(() => ChangePrefabTo("ARGreen"));
        arBlueButton.onClick.AddListener(() => ChangePrefabTo("ARBlue"));
        arRedButton.onClick.AddListener(() => ChangePrefabTo("ARRed"));
        dismissButton.onClick.AddListener(Dismiss);
    }
Ejemplo n.º 18
0
    void Start()

    {
        sessionOrigin = GetComponent <ARSessionOrigin>();
        castManager   = GetComponent <ARRaycastManager>();
        hits          = new List <ARRaycastHit>();

        objectSpawned = false;
        buttonClicked = false;
        model.SetActive(false);
        canvas.SetActive(false);
    }
        bool is_pc; // prototype by running on pc when possible (no ar)

        void Awake()
        {
            m_RaycastManager = GetComponent <ARRaycastManager>();

            this.camera = GameObject.Find("AR Camera");
            Debug.Log("Initial camera position: " + this.camera.transform.position.ToString());

            this.drinkText = GameObject.Find("DrinkText");
            Debug.Log("Have drink text: " + this.drinkText.ToString());
            this.drinkText.SetActive(false);

            this.is_pc = true;
        }
    void Start()
    {
        sessionOrigin = GetComponent <ARSessionOrigin>(); //Using FindObjectOfType find ARsessionOrigin
        //sessionOrigin = GetComponent<ARRaycastManager>();
        //generate the list everytime running this file
        hits           = new List <ARRaycastHit>();
        raycastManager = FindObjectOfType <ARRaycastManager>();//not recommend if use for several time

        graffiti1IsAlreadyPlaced = false;
        graffiti2IsAlreadyPlaced = false;
        graffiti3IsAlreadyPlaced = false;
        graffiti4IsAlreadyPlaced = false;
    }
Ejemplo n.º 21
0
    private void BuildMode(ARPlaneManager planeManager, ARRaycastManager raycastManager, PlaceItem placeItem, ARTrackedImageManager imageManager)
    {
        Scan_toggle_btn.gameObject.SetActive(false);
        imageManager.enabled = false;

        Build_toggle_btn.gameObject.SetActive(true);
        Library_btn.gameObject.SetActive(true);
        Scale_btn.gameObject.SetActive(true);
        Rotate_btn.gameObject.SetActive(true);
        planeManager.enabled   = true;
        raycastManager.enabled = true;
        placeItem.enabled      = true;
    }
Ejemplo n.º 22
0
    void Start()
    {
        sessionOrigin      = GetComponent <ARSessionOrigin>();
        raycastManager     = GetComponent <ARRaycastManager>();
        planeManager       = GetComponent <ARPlaneManager>();
        hits               = new List <ARRaycastHit>();
        audioSource.volume = 0.3f;

        foreach (ButtonState button in StateButtons)
        {
            button.OnButtonClick += StateHandler;
        }
    }
Ejemplo n.º 23
0
    float speed;           // 子猫の移動スピード

    // 起動時に1度呼び出される
    void Start()
    {
        // オブジェクトに追加されているARRaycastManagerコンポーネントを取得
        raycastManager = GetComponent <ARRaycastManager>();

        // プレイモード用床面が設定されていて、AR使用フラグがOFFの場合は床面を表示
        if (floorPlane != null)
        {
            floorPlane.SetActive(!useAR);
        }
        // 関連付けられたCameraオブジェクトを使用するためARSessionOriginを取得する
        arSession = GetComponent <ARSessionOrigin>();
    }
        /// <summary>
        /// Start is called on the frame when a script is enabled just before any
        /// of the Update methods are called the first time.
        /// </summary>
        public virtual void Start()
        {
#if UNITY_ANDROID || UNITY_IOS
            arRaycastManager = FindObjectOfType <ARRaycastManager>();
            if (arRaycastManager == null)
            {
                Debug.Log("Missing ARRaycastManager in scene");
            }
#endif
#if WINDOWS_UWP || UNITY_WSA
            UnityEngine.XR.WSA.Input.InteractionManager.InteractionSourcePressed += InteractionManager_InteractionSourcePressed;
#endif
        }
Ejemplo n.º 25
0
    private void OnEnable()
    {
        if (!arCamera)
        {
            arCamera = transform.GetChild(0).GetComponent <Camera>();
        }
        if (!arRaycaster)
        {
            arRaycaster = GetComponent <ARRaycastManager>();
        }

        Reset();
    }
Ejemplo n.º 26
0
    //private Collider2D button;

    private void Awake()
    {
        AndroidJavaClass  unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject activity    = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity");

        activity.Call("runOnUiThread", new AndroidJavaRunnable(() => { activity.Call("onUnityModeEnded"); }));

        _arRaycastManager = GetComponent <ARRaycastManager>();
        footIcon          = FindInActiveObjectByName("FootUI");
        isObjectSpawned   = false;
        isFixed           = false;
        //button = GameObject.Find("Button").GetComponent<Collider2D>();
    }
    void Awake()
    {
        arRaycastManager = GetComponent <ARRaycastManager>();

        startPoint = Instantiate(measurementPointPrefab, Vector3.zero, Quaternion.identity);
        endPoint   = Instantiate(measurementPointPrefab, Vector3.zero, Quaternion.identity);

        measureLine = GetComponent <LineRenderer>();

        startPoint.SetActive(false);
        endPoint.SetActive(false);

        dismissButton.onClick.AddListener(Dismiss);
    }
Ejemplo n.º 28
0
    private void Start()
    {
        arOrigin     = FindObjectOfType <ARSessionOrigin>();
        arRayManager = arOrigin.GetComponent <ARRaycastManager>();

        if (deviceCam == null)
        {
#if (UNITY_ANDROID && !UNITY_EDITOR)
            AndroidJavaClass cameraClass = new AndroidJavaClass("android.hardware.Camera");
            deviceCam = cameraClass.CallStatic <AndroidJavaObject>("open");
            FlashLight();
#endif
        }
    }
Ejemplo n.º 29
0
    void Start()
    {
        LightSpawners = new List <GameObject>();

        if (Application.isEditor)
        {
            currentGameMode = GameMode.Racing;
            return;
        }

        arOrigin        = FindObjectOfType <ARSessionOrigin>();
        raycastManager  = FindObjectOfType <ARRaycastManager>();
        currentGameMode = GameMode.Placement;
    }
Ejemplo n.º 30
0
    private void Awake()
    {
        trackedImageManager = FindObjectOfType <ARTrackedImageManager>();
        raycastManager      = GetComponent <ARRaycastManager>();

        foreach (GameObject prefab in transportPrefabs)
        {
            GameObject newPrefab = Instantiate(prefab, Vector3.zero, Quaternion.identity);
            newPrefab.SetActive(false);
            newPrefab.name = prefab.name;
            spawnedPrefabs.Add(prefab.name, newPrefab);
        }
        this.enabled = false;
    }