void Awake()
    {
        arReferencePointManager = GetComponent <ARReferencePointManager>();
        clearReferencePointsButton.onClick.AddListener(ClearReferencePoints);

        debugLog.gameObject.SetActive(false);
    }
Ejemplo n.º 2
0
 void Awake()
 {
     m_RaycastManager  = GetComponent <ARRaycastManager>();
     m_ReferencePoint  = GetComponent <ARReferencePointManager>();
     ammoFuncScript    = GetComponent <AmmoFunc>();
     selectPlaneScript = GetComponent <SelectPlane>();
 }
Ejemplo n.º 3
0
    void Start()
    {
        Message      = GameObject.Find("Message").GetComponent <TMP_Text>();
        Message.text = "Start";

        planeManager          = GameObject.Find("AR Session Origin").GetComponent <ARPlaneManager>();
        pointCloudManager     = GameObject.Find("AR Session Origin").GetComponent <ARPointCloudManager>();
        ReferencePointManager = GameObject.Find("AR Session Origin").GetComponent <ARReferencePointManager>();

        if (PhotonNetwork.LocalPlayer.IsMasterClient)
        {
            if (!photonView.IsMine)
            {
                Message.text = "Start IsMasterClient but not PhotonVIewIsMine";
                return;
            }

            Message.text   = "MasterClient - please place common reference point by tapping a plane...  ";
            RaycastManager = GameObject.Find("AR Session Origin").GetComponent <ARRaycastManager>();

            m_AppMode = AppMode.TouchToHostCloudReferencePoint;
        }
        else
        {
            //Only MasterClient needs to see the environment interpretation (Points Planes)
            //Only Masterclient sets Cloud Reference Point
            VisualizePlanes(false);
            VisualizePoints(false);
            Message.text = "Not MasterClient";
            m_AppMode    = AppMode.ResolveCloudReferencePoint;
        }
    }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new cloud reference point using an existing local Reference Point.
        /// <example>
        /// The sample code below illustrates how to host a cloud reference point.
        /// <code>
        /// private ARCloudReferencePoint m_CloudReferencePoint;
        ///
        /// void HostCloudReference(Pose pose)
        /// {
        ///     // Create a local Reference Point, you may also use another
        ///     // Reference Point you may already have.
        ///     ARReferencePoint localReferencePoint =
        ///         ReferencePointManager.AddReferencePoint(pose);
        ///
        ///     // Request the cloud reference point.
        ///     m_CloudReferencePoint =
        ///         ReferencePointManager.AddCloudReferencePoint(localReferencePoint);
        /// }
        ///
        /// void Update()
        /// {
        ///     if (m_CloudReferencePoint)
        ///     {
        ///         // Check the cloud reference point state.
        ///         CloudReferenceState cloudReferenceState =
        ///             m_CloudReferencePoint.cloudReferenceState;
        ///         if (cloudReferenceState == CloudReferenceState.Success)
        ///         {
        ///             myOtherGameObject.transform.SetParent
        ///                 m_CloudReferencePoint.transform, false);
        ///             m_CloudReferencePoint = null;
        ///         }
        ///         else if (cloudReferenceState == CloudReferenceState.TaskInProgress)
        ///         {
        ///             // Wait, not ready yet.
        ///         }
        ///         else
        ///         {
        ///             // An error has occurred.
        ///         }
        ///     }
        /// }
        /// </code>
        /// </example>
        /// </summary>
        /// <param name="referencePointManager">The ReferencePointManager instance for extending.
        /// </param>
        /// <param name="referencePoint">The local <c>ARReferencePoint</c> to be used as the
        /// basis to host a new cloud reference point.</param>
        /// <returns>If successful, a <see cref="ARCloudReferencePoint"/>,
        /// otherwise <c>null</c>.</returns>
        public static ARCloudReferencePoint AddCloudReferencePoint(
            this ARReferencePointManager referencePointManager,
            ARReferencePoint referencePoint)
        {
            // Create the underlying ARCore Cloud Anchor.
            IntPtr cloudAnchorHandle = SessionApi.HostCloudAnchor(
                ARCoreExtensions.Instance.CurrentARCoreSessionHandle,
                referencePoint.AnchorHandle());

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

            // Create the GameObject that is the cloud reference point.
            ARCloudReferencePoint cloudReferencePoint =
                (new GameObject(k_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);
        }
Ejemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     mainCamera      = Camera.main;
     arCameraManager = FindObjectOfType <ARCameraManager>();
     arSession       = FindObjectOfType <ARSession>();
     //  arAnchorManager = FindObjectOfType<ARAnchorManager>();
     aRReferencePointManager = FindObjectOfType <ARReferencePointManager>();
 }
Ejemplo n.º 6
0
 void Awake()
 {
     appStateManager      = FindObjectOfType <AppStateManager>();
     generalConfiguration = FindObjectOfType <GeneralConfiguration>();
     arRaycastManager     = FindObjectOfType <ARRaycastManager>();
     placementCursor      = Instantiate(generalConfiguration.placementCursorPrefab) as GameObject;
     anchorManager        = FindObjectOfType <ARReferencePointManager>();
 }
Ejemplo n.º 7
0
 public void Cleanup(ARReferencePointManager arReferencePointManager)
 {
     if ((arReferencePointManager != null) && (arReferencePoint != null))
     {
         arReferencePointManager.RemoveReferencePoint(arReferencePoint);
         arReferencePoint = null;
     }
 }
Ejemplo n.º 8
0
 void Awake()
 {
     removeBallButton.gameObject.SetActive(false);
     arRaycastManager        = GetComponent <ARRaycastManager> ();
     arReferencePointManager = GetComponent <ARReferencePointManager> ();
     clearReferencePointsButton.onClick.AddListener(ClearReferencePoints);
     removeBallButton.onClick.AddListener(RemoveSelectedBall);
 }
Ejemplo n.º 9
0
    void Start()
    {
        raycastManager = GetComponent <ARRaycastManager>();
        refManager     = GetComponent <ARReferencePointManager>();
        planeManager   = GetComponent <ARPlaneManager>();

        confirmUI.SetActive(false);
    }
Ejemplo n.º 10
0
    void Awake()
    {
        arRaycastManager        = GetComponent <ARRaycastManager>();
        arReferencePointManager = GetComponent <ARReferencePointManager>();
        arPlaneManager          = GetComponent <ARPlaneManager>();

        togglePlaneDetectionButton.onClick.AddListener(TogglePlaneDetection);
        clearReferencePointButton.onClick.AddListener(ClearReferencePoints);
    }
Ejemplo n.º 11
0
 void Awake()
 {
     DelegatesHandler.GameStart += PlacePlanet;
     arRaycastManager            = GetComponent <ARRaycastManager>();
     arReferencePointManager     = GetComponent <ARReferencePointManager>();
     planetPlaced = false;
     placementIndicator.SetActive(false);
     startButton.gameObject.SetActive(false);
 }
Ejemplo n.º 12
0
    void Start()
    {
        arRaycaster     = GetComponent <ARRaycastManager>();
        refPointManager = GetComponent <ARReferencePointManager>();
        planeManager    = GetComponent <ARPlaneManager>();
        startUI         = GameObject.Find("StartUI");

        // Adding inActiveAddedPlance to the planeChanged event, so it deactivates newly added planes once Sally's placed
        planeManager.planesChanged += inActivateAddedPlanes;
    }
    void Awake()
    {
        arRaycastManager        = GetComponent <ARRaycastManager>();
        arReferencePointManager = GetComponent <ARReferencePointManager>();
        arPointCloudManager     = GetComponent <ARPointCloudManager>();

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

        debugLog.gameObject.SetActive(false);
    }
 public static ARReferencePoint GetReferencePoint(this ARReferencePointManager referencePointManager, TrackableId trackableId)
 {
     referencePointManager.GetAllReferencePoints(s_ReferencePoints);
     foreach (var referencePoint in s_ReferencePoints)
     {
         if (referencePoint.sessionRelativeData.Id == trackableId)
         {
             return(referencePoint);
         }
     }
     return(null);
 }
Ejemplo n.º 15
0
    private void Awake()
    {
        arTrackedManager        = FindObjectOfType <ARTrackedImageManager>();
        aRReferencePointManager = GetComponent <ARReferencePointManager>();
        arRaycastManager        = GetComponent <ARRaycastManager>();

        foreach (GameObject arObject in exhibitions)
        {
            GameObject newARObject = Instantiate(arObject, Vector3.zero, Quaternion.identity);
            newARObject.name = arObject.name;
            arObjects.Add(arObject.name, newARObject);
            newARObject.SetActive(false);
        }
    }
        /// <summary>
        /// Set up an anchor manager.
        /// </summary>
        /// <param name="plugin">The engine interface to update with the current anchor graph.</param>
        private AnchorManagerARF(IPlugin plugin, IHeadPoseTracker headTracker, ARSession arSession, ARSessionOrigin arSessionOrigin)
            : base(plugin, headTracker)
        {
            DebugLogSetup($"ARF: Creating AnchorManagerARF with {arSession.name} and {arSessionOrigin.name}");
            this.arSession       = arSession;
            this.arSessionOrigin = arSessionOrigin;

            this.arReferencePointManager = arSessionOrigin.gameObject.GetComponent <ARReferencePointManager>();
            if (this.arReferencePointManager == null)
            {
                DebugLogSetup($"Adding AR reference point manager to {arSessionOrigin.name}");
                this.arReferencePointManager = arSessionOrigin.gameObject.AddComponent <ARReferencePointManager>();
            }
            DebugLogSetup($"ARF: Created AnchorManager ARF");
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Start is called before the first frame update.
        /// </summary>
        protected async virtual void Start()
        {
#if UNITY_ANDROID || UNITY_IOS
            mainCamera              = Camera.main;
            arCameraManager         = FindObjectOfType <ARCameraManager>();
            arSession               = FindObjectOfType <ARSession>();
            arReferencePointManager = FindObjectOfType <ARReferencePointManager>();
#endif

            // Only allow the manager to start if it is properly configured.
            await EnsureValidConfiguration(disable : true, exception : false);

#if UNITY_ANDROID || UNITY_IOS
            arReferencePointManager.referencePointsChanged += ARReferencePointManager_referencePointsChanged;
#endif
        }
Ejemplo n.º 18
0
    void Start()
    {
        if (!MobileOnlyActivator.IsMobile)
        {
            return;
        }

        raycastManager        = GetComponent <ARRaycastManager>();
        planeManager          = GetComponent <ARPlaneManager>();
        referencePointManager = GetComponent <ARReferencePointManager>();
        packagePrefabs        = new Dictionary <int, GameObject>();
        packageHistory        = new Dictionary <int, GameObject>();
        referencePoints       = new Dictionary <int, ARReferencePoint>();
        placementIndicator.SetActive(false);
        HidePlaneDetection();
        isActive          = false;
        placementIsActive = false;
        selectionIsActive = false;
    }
Ejemplo n.º 19
0
 // Start is called before the first frame update
 void Start()
 {
     _pointManager = aRSessionOrigin.GetComponent <ARReferencePointManager>();
 }
Ejemplo n.º 20
0
 private void Awake()
 {
     arReferencePointManager = FindObjectsOfType <ARReferencePointManager>()[0];
 }
Ejemplo n.º 21
0
 void Awake()
 {
     arReferencePointManager = GetComponent <ARReferencePointManager> ();
 }
 void Awake()
 {
     m_ReferencePointManager      = GetComponent <ARReferencePointManager>();
     m_ReferencePointCloudManager = GetComponent <ARPointCloudManager>();
     m_ReferencePoints            = new List <ARReferencePoint>();
 }
Ejemplo n.º 23
0
        public override void Raycast(PointerEventData eventData, List <RaycastResult> resultAppendList)
        {
            if (eventCamera == null || !eventCamera.pixelRect.Contains(eventData.position))
            {
                return;
            }

            if (m_PlaneManger == null)
            {
                m_PlaneManger = arSessionOrigin.GetComponent <ARPlaneManager>();
            }
            if (m_referencePointManager == null)
            {
                m_referencePointManager = arSessionOrigin.GetComponent <ARReferencePointManager>();
            }


            if (arSessionOrigin.Raycast(eventData.position, m_raycastHits, trackableTypeMask))
            {
                m_raycastHits.Sort((r1, r2) => r1.distance.CompareTo(r2.distance));

                for (int i = 0; i < m_raycastHits.Count; i++)
                {
                    var        hit       = m_raycastHits[i];
                    GameObject hitTarget = null;

                    // Attempt to find a plane or reference point that was hit
                    if (m_PlaneManger != null)
                    {
                        ARPlane arPlane = m_PlaneManger.GetPlane(hit.trackableId);
                        if (arPlane != null)
                        {
                            hitTarget = arPlane.gameObject;
                        }
                    }

                    if (m_referencePointManager != null && hitTarget != null)
                    {
                        ARReferencePoint referencePoint = m_referencePointManager.GetReferencePoint(hit.trackableId);
                        if (referencePoint != null)
                        {
                            hitTarget = referencePoint.gameObject;
                        }
                    }

                    Vector3 worldPosition = m_SessionOrigin.transform.InverseTransformPoint(hit.pose.position);
                    Vector3 worldUp       = m_SessionOrigin.transform.TransformDirection(hit.pose.up);

                    resultAppendList.Add(
                        new RaycastResult()
                    {
                        gameObject     = hitTarget, // Send messages to the GameObject which has the trackable
                        module         = this,
                        distance       = hit.distance,
                        worldPosition  = worldPosition,
                        worldNormal    = worldUp,
                        screenPosition = eventData.position,
                        index          = i,
                        sortingLayer   = 0,
                        sortingOrder   = m_SortingOrder
                    }
                        );
                }
            }
        }
 private void Awake()
 {
     arRaycastManager        = GetComponent <ARRaycastManager>();
     arReferencePointManager = GetComponent <ARReferencePointManager>();
     arPlaneManager          = GetComponent <ARPlaneManager>();
 }
Ejemplo n.º 25
0
 void Start()
 {
     referencePointManager = GetComponent <ARReferencePointManager> ();
     arReferencePoints     = new List <ARReferencePoint> ();
 }