void SetupFloor() { if (VuforiaRuntimeUtilities.IsPlayMode()) { this.floorName = "Emulator Ground Plane"; } else { this.floorName = "Floor"; GameObject floor = new GameObject(this.floorName, typeof(BoxCollider)); floor.transform.SetParent(this.chair.transform.parent); floor.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); floor.transform.localScale = Vector3.one; floor.GetComponent <BoxCollider>().size = new Vector3(100f, 0, 100f); } }
protected override void Start() { base.Start(); this.canvasGroup = GetComponentInChildren <CanvasGroup>(); this.fadeRange = VuforiaRuntimeUtilities.IsPlayMode() ? new Vector2(0.5f, 0.6f) : new Vector2(0.9f, 1.0f); VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted); if (this.mTrackableBehaviour is VuMarkBehaviour) { this.vumarkBehaviour = (VuMarkBehaviour)this.mTrackableBehaviour; this.vumarkBehaviour.RegisterVuMarkTargetAssignedCallback(OnVuMarkTargetAssigned); this.vumarkBehaviour.RegisterVuMarkTargetLostCallback(OnVuMarkTargetLost); } }
void Update() { if (!VuforiaRuntimeUtilities.IsPlayMode() && !AnchorExists) { AnchorExists = DoAnchorsExist(); } GroundPlaneHitReceived = (AutomaticHitTestFrameCount == Time.frameCount); if (m_Playmat.IsPlaced) { debugText.SetText("(" + m_PlaymatAugmentation.transform.position.x + "," + m_PlaymatAugmentation.transform.position.y + "," + m_PlaymatAugmentation.transform.position.z + ")"); } }
public void HandleInteractiveHitTest(HitTestResult result) { // If the PlaneFinderBehaviour's Mode is Automatic, then the Interactive HitTestResult will be centered. Debug.Log("HandleInteractiveHitTest() called."); m_PlacementPreview.SetActive(false); if (result == null) { Debug.LogError("Invalid Hit Test."); return; } if (m_PositionalDeviceTracker != null && m_PositionalDeviceTracker.IsActive) { if (m_PlacementAnchor == null || TouchHandler.DoubleTap) { DestroyAnchors(); m_PlacementAnchor = m_PositionalDeviceTracker.CreatePlaneAnchor("MyPlacementAnchor_" + (++m_AnchorCounter), result); m_PlacementAnchor.name = "PlacementAnchor"; if (!VuforiaRuntimeUtilities.IsPlayMode()) { m_Floor.position = m_PlacementAnchor.transform.position; } m_PlacementAugmentation.transform.SetParent(m_PlacementAnchor.transform); m_PlacementAugmentation.transform.localPosition = Vector3.zero; } if (!m_PlacementAugmentation.activeInHierarchy) { Debug.Log("Setting Placement Augmentation to Active"); // On initial placement, unhide the augmentation m_PlacementAugmentation.SetActive(true); Debug.Log("Positioning Placement Augmentation at: " + result.Position); // parent the augmentation to the anchor m_PlacementAugmentation.transform.SetParent(m_PlacementAnchor.transform); m_PlacementAugmentation.transform.localPosition = Vector3.zero; RotateTowardCamera(m_PlacementAugmentation); m_TouchHandler.enableRotation = true; } } }
void Update() { if (PlaneManager.planeMode == PlaneManager.PlaneMode.PLACEMENT) { shadowRenderer.enabled = meshRenderer.enabled = (IsPlaced || PlaneManager.GroundPlaneHitReceived); EnablePreviewModeTransparency(!IsPlaced); if (!IsPlaced) { UtilityHelper.RotateTowardCamera(gameObject); } } else { shadowRenderer.enabled = meshRenderer.enabled = IsPlaced; } if (PlaneManager.planeMode == PlaneManager.PlaneMode.PLACEMENT && IsPlaced) { m_RotationIndicator.SetActive(Input.touchCount == 2); m_TranslationIndicator.SetActive( (TouchHandler.IsSingleFingerDragging || TouchHandler.IsSingleFingerStationary) && !m_GroundPlaneUI.IsCanvasButtonPressed()); if (TouchHandler.IsSingleFingerDragging || (VuforiaRuntimeUtilities.IsPlayMode() && Input.GetMouseButton(0))) { if (!m_GroundPlaneUI.IsCanvasButtonPressed()) { cameraToPlaneRay = mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(cameraToPlaneRay, out cameraToPlaneHit)) { if (cameraToPlaneHit.collider.gameObject.name == (VuforiaRuntimeUtilities.IsPlayMode() ? EmulatorGroundPlane : Floor.name)) { gameObject.PositionAt(cameraToPlaneHit.point); } } } } } else { m_RotationIndicator.SetActive(false); m_TranslationIndicator.SetActive(false); } }
void Start() { this.mainCamera = Camera.main; this.groundPlaneUI = FindObjectOfType <GroundPlaneUI>(); this.chairShadowRenderer = this.chairShadow.GetComponent <MeshRenderer>(); SetupMaterials(); SetupFloor(); this.augmentationScale = VuforiaRuntimeUtilities.IsPlayMode() ? 0.1f : this.productSize; this.productScale = new Vector3(this.augmentationScale, this.augmentationScale, this.augmentationScale); //this.chair.transform.localScale = this.productScale; }
void DestroyAnchors() { if (!VuforiaRuntimeUtilities.IsPlayMode()) { IEnumerable <TrackableBehaviour> trackableBehaviours = m_StateManager.GetActiveTrackableBehaviours(); string destroyed = "Destroying: "; foreach (TrackableBehaviour behaviour in trackableBehaviours) { Debug.Log(behaviour.name + "\n" + behaviour.Trackable.Name + "\n" + behaviour.Trackable.ID + "\n" + behaviour.GetType()); if (behaviour is AnchorBehaviour) { // First determine which mode (Plane or MidAir) and then delete only the anchors for that mode // Leave the other mode's anchors intact // PlaneAnchor_<GUID> // Mid AirAnchor_<GUID> destroyed += "\nGObj Name: " + behaviour.name + "\nTrackable Name: " + behaviour.Trackable.Name + "\nTrackable ID: " + behaviour.Trackable.ID + "\nPosition: " + behaviour.transform.position.ToString(); m_StateManager.DestroyTrackableBehavioursForTrackable(behaviour.Trackable); m_StateManager.ReassociateTrackables(); } } Debug.Log(destroyed); } else { m_PlacementAugmentation.transform.parent = null; DestroyObject(m_PlacementAnchor); } }
void Update() { /* * if(m_PlaneFinder != null){ * m_PlaneFinder.enabled = !IsPointerOverUIObject(); * } */ if (!VuforiaRuntimeUtilities.IsPlayMode() && !AnchorExists) { AnchorExists = DoAnchorsExist(); } GroundPlaneHitReceived = (AutomaticHitTestFrameCount == Time.frameCount); SetSurfaceIndicatorVisible( GroundPlaneHitReceived && (planeMode == PlaneMode.GROUND || (planeMode == PlaneMode.PLACEMENT && Input.touchCount == 0))); }
void Update() { if (PlaneManager.CurrentPlaneMode == PlaneManager.PlaneMode.PLACEMENT) { EnablePreviewModeTransparency(!this.IsPlaced); if (!this.IsPlaced) { UtilityHelper.RotateTowardCamera(this.chair); } } if (PlaneManager.CurrentPlaneMode == PlaneManager.PlaneMode.PLACEMENT && this.IsPlaced) { this.rotationIndicator.SetActive(Input.touchCount == 2); this.translationIndicator.SetActive( (TouchHandler.IsSingleFingerDragging || TouchHandler.IsSingleFingerStationary) && !this.groundPlaneUI.IsCanvasButtonPressed()); if (TouchHandler.IsSingleFingerDragging || (VuforiaRuntimeUtilities.IsPlayMode() && Input.GetMouseButton(0))) { if (!this.groundPlaneUI.IsCanvasButtonPressed()) { this.cameraToPlaneRay = this.mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(this.cameraToPlaneRay, out this.cameraToPlaneHit)) { if (this.cameraToPlaneHit.collider.gameObject.name == floorName) { this.chair.PositionAt(this.cameraToPlaneHit.point); } } } } } else { this.rotationIndicator.SetActive(false); this.translationIndicator.SetActive(false); } }
void Start() { Debug.Log("Start() called."); VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted); VuforiaARController.Instance.RegisterOnPauseCallback(OnVuforiaPaused); DeviceTrackerARController.Instance.RegisterTrackerStartedCallback(OnTrackerStarted); DeviceTrackerARController.Instance.RegisterDevicePoseStatusChangedCallback(OnDevicePoseStatusChanged); m_PlaneFinder.HitTestMode = HitTestMode.AUTOMATIC; m_PlacementAugmentationScale = VuforiaRuntimeUtilities.IsPlayMode() ? 0.1f : ProductSize; ProductScaleVector = new Vector3(m_PlacementAugmentationScale, m_PlacementAugmentationScale, m_PlacementAugmentationScale); m_PlacementPreview.transform.localScale = ProductScaleVector; m_PlacementAugmentation.transform.localScale = ProductScaleVector; m_GroundToggle.interactable = false; m_MidAirToggle.interactable = false; m_PlacementToggle.interactable = false; m_ResetButton.interactable = false; // Enable floor collider if running on device; Disable if running in PlayMode Floor.gameObject.SetActive(!VuforiaRuntimeUtilities.IsPlayMode()); m_IconGroundMode = Resources.Load <Sprite>("icon_ground_mode"); m_IconMidAirMode = Resources.Load <Sprite>("icon_midair_mode"); m_IconPlacementMode = Resources.Load <Sprite>("icon_placement_mode"); m_TitleMode.text = TITLE_PLACEMENT; m_PlaneModeIcon.sprite = m_IconPlacementMode; mainCamera = Camera.main; m_TouchHandler = FindObjectOfType <TouchHandler>(); m_GraphicRayCaster = FindObjectOfType <GraphicRaycaster>(); m_EventSystem = FindObjectOfType <EventSystem>(); }
// Update is called once per frame void Update() { if (m_PlacementAugmentation.activeInHierarchy) { m_RotationIndicator.SetActive(Input.touchCount == 2); m_TranslationIndicator.SetActive(TouchHandler.IsSingleFingerDragging()); if (TouchHandler.IsSingleFingerDragging() || (VuforiaRuntimeUtilities.IsPlayMode() && Input.GetMouseButton(0))) { if (!IsCanvasButtonPressed()) { cameraPlaneRay = mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(cameraPlaneRay, out cameraToPlaneHit)) { if (cameraToPlaneHit.collider.gameObject.name == (VuforiaRuntimeUtilities.IsPlayMode() ? EmulatorGroundPlane : m_Floor.name)) { m_PlacementAugmentation.PositionAt(cameraToPlaneHit.point); } } } } } }
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; }
void UpdateVuMarkBorderOutline() { if (this.lineRenderer) { // Only enable line renderer when target becomes Extended Tracked or when running in Unity Editor. this.lineRenderer.enabled = (m_NewStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) || VuforiaRuntimeUtilities.IsPlayMode(); if (this.lineRenderer.enabled) { // If the Device Tracker is enabled and the target becomes Extended Tracked, // set the VuMark outline to green. If in Unity Editor PlayMode, set to cyan. // Note that on HoloLens, the Device Tracker is always enabled (as of Vuforia 7.2). this.lineRenderer.material.color = (m_NewStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) ? Color.green : Color.cyan; } } else { this.lineRenderer = GetComponentInChildren <LineRenderer>(); } }
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>()); }
void Update() { objectRenderer.enabled = (IsPlaced); if (PlaneManagerTest.planeMode == PlaneManagerTest.PlaneMode.TGO && IsPlaced) { m_RotationIndicator.SetActive(Input.touchCount == 2); Debug.Log("Input.touchCount is " + Input.touchCount); Debug.Log("Is RotationIndicator active?" + m_RotationIndicator.activeSelf); m_TranslationIndicator.SetActive( (TGOTouchHandlerTest.IsSingleFingerDragging || TGOTouchHandlerTest.IsSingleFingerStationary) && !m_GroundPlaneUI.IsCanvasButtonPressed()); if (TGOTouchHandlerTest.IsSingleFingerDragging || (VuforiaRuntimeUtilities.IsPlayMode() && Input.GetMouseButton(0))) { if (!m_GroundPlaneUI.IsCanvasButtonPressed()) { cameraToPlaneRay = mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(cameraToPlaneRay, out cameraToPlaneHit)) { if (cameraToPlaneHit.collider.gameObject.name == (VuforiaRuntimeUtilities.IsPlayMode() ? EmulatorGroundPlane : Floor.name)) { gameObject.PositionAt(cameraToPlaneHit.point); } } } } } else { m_RotationIndicator.SetActive(false); m_TranslationIndicator.SetActive(false); } }
void Update() { if (PlaneManager.planeMode == PlaneManager.PlaneMode.PLACEMENT) { // shadowRenderer.enabled = foreach (Renderer shoeRenderer in shoeRenderers) { shoeRenderer.enabled = (IsPlaced || PlaneManager.GroundPlaneHitReceived || PlaneManager.indicator); } foreach (MeshCollider meshCollider in meshColliders) { meshCollider.enabled = !doesHitShoe; } } else { foreach (Renderer shoeRenderer in shoeRenderers) { shoeRenderer.enabled = !IsPlaced; } } if (PlaneManager.planeMode == PlaneManager.PlaneMode.PLACEMENT && !IsPlaced) { m_RotationIndicator.SetActive(Input.touchCount == 2); if (m_RotationIndicator.activeSelf) { m_RotationIndicator.transform.position = copyShoe.transform.position; m_RotationIndicator.transform.position -= Vector3.up * 0.2f; } m_TranslationIndicator.SetActive( !m_GroundPlaneUI.IsCanvasUIPressed() && (TouchHandler.IsSingleFingerDragging || TouchHandler.IsSingleFingerStationary) && doesHitShoe); if (m_TranslationIndicator.activeSelf) { m_TranslationIndicator.transform.position = copyShoe.transform.position; m_TranslationIndicator.transform.position -= Vector3.up * 0.2f; } if (!m_GroundPlaneUI.IsCanvasUIPressed()) { if (Input.GetMouseButtonDown(0)) { cameraToPlaneRay = mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(cameraToPlaneRay, out hit)) { if (hit.collider.name.Equals(VuforiaRuntimeUtilities.IsPlayMode() ? EmulatorGroundPlane : Floor.name)) { doesHitShoe = false; } else { doesHitShoe = true; } } } else if (TouchHandler.IsSingleFingerDragging || (VuforiaRuntimeUtilities.IsPlayMode() && Input.GetMouseButton(0))) { cameraToPlaneRay = mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(cameraToPlaneRay, out hit)) { if (hit.collider.gameObject.name == (VuforiaRuntimeUtilities.IsPlayMode() ? EmulatorGroundPlane : Floor.name) && doesHitShoe) { gameObject.PositionAt(hit.point); } } } else if (Input.GetMouseButtonUp(0)) { doesHitShoe = false; } } } else { m_RotationIndicator.SetActive(false); m_TranslationIndicator.SetActive(false); } }
/// <summary> /// Try to pick video at tap screen position /// </summary> public void TryPickingVideo() { Debug.Log("rrrrr+fff"); if (VuforiaRuntimeUtilities.IsPlayMode()) { if (PickVideo(Input.mousePosition) != null) { Debug.LogWarning("Playing videos is currently not supported in Play Mode."); } } // Find out which video was tapped, if any currentVideo = PickVideo(Input.mousePosition); if (currentVideo != null) { if (playFullscreen) { if (currentVideo.VideoPlayer.IsPlayableFullscreen()) { //On Android, we use Unity's built in player, so Unity application pauses before going to fullscreen. //So we have to handle the orientation from within Unity. #if UNITY_ANDROID Screen.orientation = ScreenOrientation.LandscapeLeft; #endif // Pause the video if it is currently playing currentVideo.VideoPlayer.Pause(); // Seek the video to the beginning(); currentVideo.VideoPlayer.SeekTo(0.0f); // Display the busy icon currentVideo.ShowBusyIcon(); // Play the video full screen StartCoroutine(PlayFullscreenVideoAtEndOfFrame(currentVideo)); } } else { if (currentVideo.VideoPlayer.IsPlayableOnTexture()) { // This video is playable on a texture, toggle playing/paused VideoPlayerHelper.MediaState state = currentVideo.VideoPlayer.GetStatus(); if (state == VideoPlayerHelper.MediaState.PAUSED || state == VideoPlayerHelper.MediaState.READY || state == VideoPlayerHelper.MediaState.STOPPED) { // Pause other videos before playing this one PauseOtherVideos(currentVideo); // Play this video on texture where it left off currentVideo.VideoPlayer.Play(false, currentVideo.VideoPlayer.GetCurrentPosition()); } else if (state == VideoPlayerHelper.MediaState.REACHED_END) { // Pause other videos before playing this one PauseOtherVideos(currentVideo); // Play this video from the beginning currentVideo.VideoPlayer.Play(false, 0); } else if (state == VideoPlayerHelper.MediaState.PLAYING) { // Video is already playing, pause it currentVideo.VideoPlayer.Pause(); } } else { // Display the busy icon currentVideo.ShowBusyIcon(); // This video cannot be played on a texture, play it full screen StartCoroutine(PlayFullscreenVideoAtEndOfFrame(currentVideo)); } } } }
void Update() { // Determine the number of taps // Note: Input.tapCount doesn't work on Android if (Input.touchCount > 0) { Touch touch = Input.touches[0]; if (touch.phase == TouchPhase.Began) { mTouchStartPos = touch.position; mTouchMoved = false; mTimeElapsed = 0.0f; } else { mTimeElapsed += Time.deltaTime; } if (touch.phase == TouchPhase.Moved) { if (Vector2.Distance(mTouchStartPos, touch.position) > 40) { // Touch moved too far mTouchMoved = true; } } else if (touch.phase == TouchPhase.Ended) { if (!mTouchMoved && mTimeElapsed < 1.0) { if (mTapped) { // Second tap HandleDoubleTap(); mTapped = false; } else { // Wait to see if this is a double tap mTapped = true; mTimeElapsedSinceTap = 0.0f; } } } } if (mTapped) { if (mTimeElapsedSinceTap >= 0.5f) { // Not a double tap HandleTap(); mTapped = false; } else { mTimeElapsedSinceTap += Time.deltaTime; } } // special handling in play mode: if (VuforiaRuntimeUtilities.IsPlayMode()) { if (Input.GetMouseButtonUp(0)) { if (PickVideo(Input.mousePosition) != null) { Debug.LogWarning("Playing videos is currently not supported in Play Mode."); } } } }
public void HandleInteractiveHitTest(HitTestResult result) { if (result == null) { Debug.LogError("Invalid hit test result!"); return; } if (m_StatusInfo == TrackableBehaviour.StatusInfo.NORMAL || (m_StatusInfo == TrackableBehaviour.StatusInfo.UNKNOWN && !VuforiaRuntimeUtilities.IsPlayMode())) { if (!m_GroundPlaneUI.IsCanvasButtonPressed()) { Debug.Log("HandleInteractiveHitTest() called."); // If the PlaneFinderBehaviour's Mode is Automatic, then the Interactive HitTestResult will be centered. // PlaneMode.Ground and PlaneMode.Placement both use PlaneFinder's ContentPositioningBehaviour m_ContentPositioningBehaviour = m_PlaneFinder.GetComponent <ContentPositioningBehaviour>(); m_ContentPositioningBehaviour.DuplicateStage = false; // Place object based on Ground Plane mode switch (planeMode) { case PlaneMode.NONE: /* * m_ContentPositioningBehaviour.AnchorStage = m_PlaneAnchor; * m_ContentPositioningBehaviour.PositionContentAtPlaneAnchor(result); * UtilityHelper.EnableRendererColliderCanvas(m_PlaneAugmentation, true); * * // Astronaut should rotate toward camera with each placement * m_PlaneAugmentation.transform.localPosition = Vector3.zero; * UtilityHelper.RotateTowardCamera(m_PlaneAugmentation); */ UtilityHelper.EnableRendererColliderCanvas(m_PlacementAugmentation, false); ResetScene(); ResetTrackers(); arRCM.FadeCanvas(false); break; /* * * case PlaneMode.GROUND: * * m_ContentPositioningBehaviour.AnchorStage = m_PlaneAnchor; * m_ContentPositioningBehaviour.PositionContentAtPlaneAnchor(result); * UtilityHelper.EnableRendererColliderCanvas(m_PlaneAugmentation, true); * * // Astronaut should rotate toward camera with each placement * m_PlaneAugmentation.transform.localPosition = Vector3.zero; * UtilityHelper.RotateTowardCamera(m_PlaneAugmentation); * * break; */ case PlaneMode.PLACEMENT: if (!m_ProductPlacement.IsPlaced || TouchHandler.DoubleTap) { m_ContentPositioningBehaviour.AnchorStage = m_PlacementAnchor; m_ContentPositioningBehaviour.PositionContentAtPlaneAnchor(result); UtilityHelper.EnableRendererColliderCanvas(m_PlacementAugmentation, true); arRCM.FadeCanvas(true); } if (!m_ProductPlacement.IsPlaced) { m_ProductPlacement.SetProductAnchor(m_PlacementAnchor.transform); m_TouchHandler.enableRotation = true; } break; } } } }
public void HandleInteractiveHitTest(HitTestResult result) { // If the PlaneFinderBehaviour's Mode is Automatic, then the Interactive HitTestResult will be centered. Debug.Log("HandleInteractiveHitTest() called."); if (result == null) { Debug.LogError("Invalid hit test result!"); return; } // Place object based on Ground Plane mode switch (planeMode) { case PlaneMode.GROUND: if (m_PositionalDeviceTracker != null && m_PositionalDeviceTracker.IsActive) { DestroyAnchors(); m_PlaneAnchor = m_PositionalDeviceTracker.CreatePlaneAnchor("MyPlaneAnchor_" + (++m_AnchorCounter), result); m_PlaneAnchor.name = "PlaneAnchor"; if (!m_MidAirToggle.interactable) { // Runs only once after first successful Ground Anchor is created m_MidAirToggle.interactable = true; m_ResetButton.interactable = true; } } if (!m_PlaneAugmentation.activeInHierarchy) { Debug.Log("Setting Plane Augmentation to Active"); // On initial run, unhide the augmentation m_PlaneAugmentation.SetActive(true); } Debug.Log("Positioning Plane Augmentation at: " + result.Position); // parent the augmentation to the anchor m_PlaneAugmentation.transform.SetParent(m_PlaneAnchor.transform); m_PlaneAugmentation.transform.localPosition = Vector3.zero; RotateTowardCamera(m_PlaneAugmentation); break; case PlaneMode.PLACEMENT: if (m_PositionalDeviceTracker != null && m_PositionalDeviceTracker.IsActive) { if (m_PlacementAnchor == null || TouchHandler.DoubleTap) { DestroyAnchors(); m_PlacementAnchor = m_PositionalDeviceTracker.CreatePlaneAnchor("MyPlacementAnchor_" + (++m_AnchorCounter), result); m_PlacementAnchor.name = "PlacementAnchor"; if (!VuforiaRuntimeUtilities.IsPlayMode()) { Floor.position = m_PlacementAnchor.transform.position; } m_PlacementAugmentation.transform.SetParent(m_PlacementAnchor.transform); m_PlacementAugmentation.transform.localPosition = Vector3.zero; } if (!m_MidAirToggle.interactable) { // Runs only once after first successful Ground Anchor is created m_MidAirToggle.interactable = true; m_ResetButton.interactable = true; } } if (!m_PlacementAugmentation.activeInHierarchy) { Debug.Log("Setting Placement Augmentation to Active"); // On initial placement, unhide the augmentation m_PlacementAugmentation.SetActive(true); Debug.Log("Positioning Placement Augmentation at: " + result.Position); // parent the augmentation to the anchor m_PlacementAugmentation.transform.SetParent(m_PlacementAnchor.transform); m_PlacementAugmentation.transform.localPosition = Vector3.zero; RotateTowardCamera(m_PlacementAugmentation); m_TouchHandler.enableRotation = true; } break; } }