Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        m_planeManagerA = ARContentA.GetComponentInChildren <PlaneManager>();
        m_planeManagerB = ARContentB.GetComponentInChildren <PlaneManager>();

        m_anchorInputListenerBehaviourA = ARContentA.GetComponentInChildren <AnchorInputListenerBehaviour>();
        m_anchorInputListenerBehaviourB = ARContentB.GetComponentInChildren <AnchorInputListenerBehaviour>();

        m_planeFinderBehaviourA = ARContentA.GetComponentInChildren <PlaneFinderBehaviour>();
        m_planeFinderBehaviourB = ARContentB.GetComponentInChildren <PlaneFinderBehaviour>();

        m_contentPositioningBehaviourA = ARContentA.GetComponentInChildren <ContentPositioningBehaviour>();
        m_contentPositioningBehaviourB = ARContentB.GetComponentInChildren <ContentPositioningBehaviour>();

        m_anchorBehaviourA = ARContentA.GetComponentInChildren <AnchorBehaviour>();
        m_anchorBehaviourB = ARContentB.GetComponentInChildren <AnchorBehaviour>();

        m_productPlacementA = ARContentA.GetComponentInChildren <ProductPlacement>();
        m_productPlacementB = ARContentB.GetComponentInChildren <ProductPlacement>();

        m_touchHandlerA = ARContentA.GetComponentInChildren <TouchHandler>();
        m_touchHandlerB = ARContentB.GetComponentInChildren <TouchHandler>();

        TurnOffBehaviour(false);
        TurnOffBehaviour(true);
        TurnOffBehaviour(false);
    }
Ejemplo n.º 2
0
        private void Start()
        {
            planeFinderBehaviour = FindObjectOfType <PlaneFinderBehaviour>();
            mainCamera           = ARLocationManager.Instance.MainCamera;

            if (planeFinderBehaviour == null)
            {
                Logger.WarnFromMethod("VuforiaGroundHeight", "Start", "No planeFinderBehaviour!");
            }

            if (Settings.UseArLocationConfigSettings)
            {
                Settings.MaxGroundHeight          = ARLocation.Config.MaxGroundHeight;
                Settings.MinGroundHeight          = ARLocation.Config.MinGroundHeight;
                Settings.InitialGroundHeightGuess = ARLocation.Config.InitialGroundHeightGuess;
                Settings.MinHitDistance           = ARLocation.Config.VuforiaGroundHitTestDistance;
                Settings.Smoothing = ARLocation.Config.GroundHeightSmoothingFactor;
            }

            state.CurrentGroundY = -Settings.InitialGroundHeightGuess;

            planeFinderBehaviour.Height      = Settings.InitialGroundHeightGuess;
            planeFinderBehaviour.HitTestMode = HitTestMode.AUTOMATIC;
            planeFinderBehaviour.OnAutomaticHitTest.AddListener(HitTestHandler);
            planeFinderBehaviour.OnInteractiveHitTest.AddListener(HitTestHandler);

            UpdateObjectHeight();
        }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        textCmp  = gameObject.GetComponent <Text>();
        planeCmp = planeFinder.GetComponent <PlaneFinderBehaviour>();


        textCmp.text = "AAA";
    }
Ejemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        Button btn = this.GetComponent <Button>();

        btn.onClick.AddListener(AddValue);

        planeCmp = planeFinder.GetComponent <PlaneFinderBehaviour>();
    }
    public VuforiaPlacementProvider()
    {
        sceneObj    = GameObject.Instantiate(Resources.Load <GameObject>("VuforiaScene"));
        planeFinder = sceneObj.GetComponentInChildren <PlaneFinderBehaviour>();
        planeFinder.OnAutomaticHitTest.AddListener(HandleAutomaticHitTest);

        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);
    }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     pivotAdjuster      = FindObjectOfType <PivotAdjuster>();
     planeFinder        = FindObjectOfType <PlaneFinderBehaviour>();
     contentPositioning = planeFinder.GetComponent <ContentPositioningBehaviour>();
     //debugText.text = Application.persistentDataPath;
     //selectedModel = test;
     ////modelSelected = true;
     //selectedModel = tobasco;
     //modelSelected = true;
 }
Ejemplo n.º 7
0
    public void PlaneFinderOnOff(bool yn)
    {
        if (g.goPlaneFinder == null)
        {
            Debug.Log("!plane finder game object");
            return;
        }
        PlaneFinderBehaviour planeFinder = g.goPlaneFinder.GetComponent <PlaneFinderBehaviour>();

        if (planeFinder != null)
        {
            planeFinder.enabled = yn;
        }
        else
        {
            Debug.Log("!plane finder behavior");
        }
    }
Ejemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     p = GetComponent <PlaneFinderBehaviour>();
     InvokeRepeating("replace", 2.0f, 1.0f);
 }
Ejemplo n.º 9
0
        } //END Start

        //------------------------//
        private void CheckIfVuforiaComponentsAreConnected()
        //------------------------//
        {

#if VUFORIA
            //Grab the VuforiaBehaviour component, if it doesn't exist then create it
            if( vuforiaBehaviour == null )
            {
                if( GetComponent<VuforiaBehaviour>() == null )
                {
                    gameObject.AddComponent<VuforiaBehaviour>();
                }

                vuforiaBehaviour = GetComponent<VuforiaBehaviour>();
            }

            //Grab the DefaultInitializationError component, if it doesn't exist then create it
            if( defaultInitializationErrorHandler == null )
            {
                if( GetComponent<DefaultInitializationErrorHandler>() == null )
                {
                    gameObject.AddComponent<DefaultInitializationErrorHandler>();
                }

                defaultInitializationErrorHandler = GetComponent<DefaultInitializationErrorHandler>();
            }

            //Grab the Plane finder child gameObject, if it doesn't exist then create it
            if( planeFinderGameObject == null )
            {
                if( this.GetComponentInChildren<Transform>() == null )
                {
                    planeFinderGameObject = new GameObject( "Plane Finder" );
                    planeFinderGameObject.transform.parent = this.transform;
                }
                else
                {
                    planeFinderGameObject = this.GetComponentInChildren<Transform>().gameObject;
                }
            }

            //If the scripts don't exist, grab them. If they're completely missing, then add them now
            if( anchorInputListenerBehaviour == null )
            {
                if( this.GetComponentInChildren<AnchorInputListenerBehaviour>() != null )
                {
                    anchorInputListenerBehaviour = this.GetComponentInChildren<AnchorInputListenerBehaviour>();
                }
                else
                {
                    anchorInputListenerBehaviour = planeFinderGameObject.AddComponent<AnchorInputListenerBehaviour>();
                }
            }

            if( planeFinderBehaviour == null )
            {
                if( this.GetComponentInChildren<PlaneFinderBehaviour>() != null )
                {
                    planeFinderBehaviour = this.GetComponentInChildren<PlaneFinderBehaviour>();
                }
                else
                {
                    planeFinderBehaviour = planeFinderGameObject.AddComponent<PlaneFinderBehaviour>();
                }
            }

            //Link the AnchorInputListener's OnInputRecieved event to the PlaneFinder HitTest if that link is missing
            if ( anchorInputListenerBehaviour.OnInputReceivedEvent != null &&
                ( anchorInputListenerBehaviour.OnInputReceivedEvent.GetPersistentEventCount() == 0 ||
                  anchorInputListenerBehaviour.OnInputReceivedEvent.GetPersistentTarget( 0 ) != planeFinderBehaviour ) )
            {
                //Add a Non-Persistent listener to this event. This will work but it won't be visible in the editor and won't be linked to the event after play mode ends
                anchorInputListenerBehaviour.OnInputReceivedEvent.AddListener( planeFinderBehaviour.PerformHitTest );
            }

            //Link the planeFinderBehaviour's OnInteractiveHitTest and OnAutomaticHitTest to this script if that linkage is missing
            if( planeFinderBehaviour.OnAutomaticHitTest != null &&
                ( planeFinderBehaviour.OnAutomaticHitTest.GetPersistentEventCount() == 0 ||
                  planeFinderBehaviour.OnAutomaticHitTest.GetPersistentTarget( 0 ) != this ) )
            {
                planeFinderBehaviour.OnInteractiveHitTest.AddListener( OnInteractiveHitTest );
            }

            if( planeFinderBehaviour.OnInteractiveHitTest != null &&
                ( planeFinderBehaviour.OnInteractiveHitTest.GetPersistentEventCount() == 0 ||
                  planeFinderBehaviour.OnInteractiveHitTest.GetPersistentTarget( 0 ) != this ) )
            {
                planeFinderBehaviour.OnAutomaticHitTest.AddListener( OnAutomaticHitTest );
            }
#endif

        } //END CheckIfVuforiaComponentsAreConnected