Beispiel #1
0
    /// <summary>
    /// This method manages user interaction
    /// </summary>
    protected override void ProcessTouch(Touch touch)
    {
        TrackableHit      hit;
        TrackableHitFlags raycastFilter =
            TrackableHitFlags.PlaneWithinPolygon;

        if (ARCoreWorldOriginHelper.Raycast(touch.position.x, touch.position.y,
                                            raycastFilter, out hit))
        {
            m_LastPlacedAnchor = hit.Trackable.CreateAnchor(hit.Pose);
        }

        if (m_LastPlacedAnchor != null)
        {
            if (_CanPlaceFlags())
            {
                mapBuilder.ProcessTouches();
            }
            else if (!m_IsOriginPlaced)
            {
                SetWorldOrigin(m_LastPlacedAnchor.transform);
                _InstantiateAnchor();
                OnAnchorInstantiated();
            }
        }
    }
    protected override void ProcessTouch(Touch touch)
    {
        TrackableHit      hit;
        TrackableHitFlags raycastFilter =
            TrackableHitFlags.PlaneWithinPolygon;

        if (ARCoreWorldOriginHelper.Raycast(touch.position.x, touch.position.y,
                                            raycastFilter, out hit))
        {
            m_LastPlacedAnchor = hit.Trackable.CreateAnchor(hit.Pose);
        }

        if (_CanPlaceFlags())
        {
            ((ClientMapBuilder)mapBuilder).ProcessTouches();
        }
    }
Beispiel #3
0
    public void RpcStartPlacement()
    {
        //Disable AR features
        GameObject w = GameObject.Find("ARCore World Origin Helper");
        ARCoreWorldOriginHelper helperScript = w.GetComponent <ARCoreWorldOriginHelper>();

        helperScript.SetNoPlanes(true);
        //Pointcloud
        GameObject pc = GameObject.Find("Point Cloud");

        pc.SetActive(false);
        GameObject[] meshes = GameObject.FindGameObjectsWithTag("Mesh");
        foreach (GameObject m in meshes)
        {
            m.SetActive(false);
        }
        GameObject.Find("Network Manager").GetComponent <NetworkManagerUIController>().ShowErrorMessage("Pick a side and place your units with gold. Press Ready to start game.");
    }