示例#1
0
    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);

        m_PlaneFinderBehaviour.HitTestMode = HitTestMode.AUTOMATIC;

        m_ProductPlacement = FindObjectOfType <ProductPlacement>();
        m_TouchHandler     = FindObjectOfType <TouchHandler>();
        m_GroundPlaneUI    = FindObjectOfType <GroundPlaneUI>();

        copyShoe.transform.SetParent(m_ProductPlacement.gameObject.transform);
        #if (UNITY_IOS || !UNITY_ANDROID)
        copyShoe.GetComponentInChildren <Transform>().transform.localScale = new Vector3(2.5f, 2.5f, 2.5f);
        #elif UNITY_ANDROID
        copyShoe.GetComponentInChildren <Transform>().transform.localScale = new Vector3(6f, 6f, 6f);
        #endif
        copyShoe.GetComponentsInChildren <Transform>()[1].localRotation = Quaternion.Euler(0, 0, 0);

        m_PlacementAugmentation = copyShoe.transform.parent.gameObject;

        m_PlacementAnchor = m_PlacementAugmentation.GetComponentInParent <AnchorBehaviour>();

        UtilityHelper.EnableRendererColliderCanvas(m_PlacementAugmentation, false);
        m_PlaneFinder.SetActive(false);
        shadowPlane = GameObject.Find("ShadowPlane");
        shadowPlane.transform.SetParent(copyShoe.transform);
        shadowPlane.transform.localPosition = new Vector3(0, 0, 0);
        #if (UNITY_IOS || !UNITY_ANDROID)
        shadowPlane.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
        shadowPlane.transform.position  -= Vector3.up * 0.2f;
        #elif UNITY_ANDROID
        shadowPlane.transform.localScale = new Vector3(0.22f, 0.22f, 0.22f);
        shadowPlane.transform.position  -= Vector3.up * 0.4f;
        #endif
        shadowPlane.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
        m_ProductPlacement.SetProductAnchor(null);
    }
    void Start()
    {
        meshRenderer = GetComponent <MeshRenderer>();


        chairMaterials = new Material[]
        {
            Resources.Load <Material>("ChairBody"),
            Resources.Load <Material>("ChairFrame")
        };

        chairMaterialsTransparent = new Material[]
        {
            Resources.Load <Material>("ChairBodyTransparent"),
            Resources.Load <Material>("ChairFrameTransparent")
        };


        ChairShadow            = Resources.Load <Material>("ChairShadow");
        ChairShadowTransparent = Resources.Load <Material>("ChairShadowTransparent");


        m_GroundPlaneUI = FindObjectOfType <GroundPlaneUI>();

        // Enable floor collider if running on device; Disable if running in PlayMode
        Floor.gameObject.SetActive(!VuforiaRuntimeUtilities.IsPlayMode());


        mainCamera = Camera.main;

        m_PlacementAugmentationScale = VuforiaRuntimeUtilities.IsPlayMode() ? 0.1f : ProductSize;

        ProductScaleVector =
            new Vector3(m_PlacementAugmentationScale,
                        m_PlacementAugmentationScale,
                        m_PlacementAugmentationScale);

        gameObject.transform.localScale = ProductScaleVector;
    }
示例#3
0
    void Start()
    {
        m_GroundPlaneUI = FindObjectOfType <GroundPlaneUI>();

        // Enable floor collider if running on device; Disable if running in PlayMode
        Floor.gameObject.SetActive(!VuforiaRuntimeUtilities.IsPlayMode());

        mainCamera = Camera.main;

        m_PlacementAugmentationScale = VuforiaRuntimeUtilities.IsPlayMode() ? 1f : ProductSize;

        ProductScaleVector =
            new Vector3(m_PlacementAugmentationScale,
                        m_PlacementAugmentationScale,
                        m_PlacementAugmentationScale);

        gameObject.transform.localScale = ProductScaleVector;

        copyShoe      = GameObject.Find("CopyShoe");
        shoeRenderers = copyShoe.GetComponentsInChildren <MeshRenderer>();
        doesHitShoe   = false;
        meshColliders.AddRange(copyShoe.GetComponentsInChildren <MeshCollider>());
    }
示例#4
0
    static bool anchorExists; // backs public AnchorExists property
    #endregion                // PRIVATE_MEMBERS


    #region MONOBEHAVIOUR_METHODS

    void Start()
    {
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);
        VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused);
        DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted);
        DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged);

        m_PlaneFinder.HitTestMode = HitTestMode.AUTOMATIC;

        m_ProductPlacement = FindObjectOfType <ProductPlacement>();
        m_TouchHandler     = FindObjectOfType <TouchHandler>();
        m_GroundPlaneUI    = FindObjectOfType <GroundPlaneUI>();

        m_PlaneAnchor     = m_PlaneAugmentation.GetComponentInParent <AnchorBehaviour>();
        m_MidAirAnchor    = m_MidAirAugmentation.GetComponentInParent <AnchorBehaviour>();
        m_PlacementAnchor = m_PlacementAugmentation.GetComponentInParent <AnchorBehaviour>();

        UtilityHelper.EnableRendererColliderCanvas(m_PlaneAugmentation, false);
        UtilityHelper.EnableRendererColliderCanvas(m_MidAirAugmentation, false);
        UtilityHelper.EnableRendererColliderCanvas(m_PlacementAugmentation, false);

        SetNoneMode();
    }
示例#5
0
 // Use this for initialization
 void Start()
 {
     m_planeManager  = GameObject.Find("PlaneManager").GetComponent <PlaneManager>();
     m_groundPlaneUI = GameObject.Find("Behaviour").GetComponent <GroundPlaneUI>();
 }