public void HandleAutomaticHitTest(HitTestResult result) { AutomaticHitTestFrameCount = Time.frameCount; if (!uiHasBeenInitialized) { uiHasBeenInitialized = m_GroundPlaneUI.InitializeUI(); } if (planeMode == PlaneMode.PLACEMENT && !m_ProductPlacement.IsPlaced) { SetSurfaceIndicatorVisible(false); m_ProductPlacement.SetProductAnchor(null); m_PlacementAugmentation.PositionAt(result.Position); } }
public void HandleAutomaticHitTest(HitTestResult result) { AutomaticHitTestFrameCount = Time.frameCount; //if (!uiHasBeenInitialized) //{ // uiHasBeenInitialized = m_GroundPlaneUI.InitializeUI(); //} if (indicator == null) { indicator = GameObject.Find("Indicator").gameObject; indicator.transform.localScale = new Vector3(1f, 1f, 1f); indicator.transform.position -= Vector3.up * 0.3f; } else if (!m_ProductPlacement.IsPlaced && indicator.activeSelf) { m_PlacementAugmentation.transform.rotation = Quaternion.Euler(0, 0, 0); SetSurfaceIndicatorVisible(false); m_ProductPlacement.SetProductAnchor(null); m_PlacementAugmentation.transform.position = m_PlaneFinder.GetComponentsInChildren <Transform>()[1].position; //m_PlacementAugmentation.transform.position += Vector3.up * 0.1f; //shadowPlane.transform.position = m_PlacementAugmentation.transform.position - Vector3.up * 0.2f; } }
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); }