void OnSelectedAnchorsDataChanged(SelectObjectDragToolAction.IAnchor newData) { if (newData == null) { if (m_DraggablePad.isActiveAndEnabled) { Dispatcher.Dispatch(SetStatusMessageWithType.From(new StatusMessageData { text = k_InstructionDragPoint, type = StatusMessageType.Instruction })); } else { Dispatcher.Dispatch(SetStatusMessageWithType.From(new StatusMessageData { text = k_InstructionStart, type = StatusMessageType.Instruction })); } return; } Dispatcher.Dispatch(ClearStatusAction.From(true)); Dispatcher.Dispatch(ClearStatusAction.From(false)); // Create Point if (!m_OnDrag) { if (!m_CurrentCursor.activeSelf) { m_AnchorSelection.OnStateDataChanged(newData, m_CurrentCursor); return; } } // Drag Existing Point m_AnchorSelection.OnStateDataChanged(newData); }
void AlignModelView() { m_Raycaster.Reset(); m_Raycaster.ActiveScanning = false; m_Raycaster.DisableCursor(); Dispatcher.Dispatch(SetActiveToolAction.From(SetActiveToolAction.ToolType.OrbitTool)); var arToolStateData = SetARToolStateAction.SetARToolStateData.defaultData; arToolStateData.navigationEnabled = true; arToolStateData.okEnabled = true; arToolStateData.okButtonValidator = this; arToolStateData.scaleEnabled = false; arToolStateData.rotateEnabled = false; arToolStateData.selectionEnabled = false; arToolStateData.measureToolEnabled = false; Dispatcher.Dispatch(SetARToolStateAction.From(arToolStateData)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionAlignModelView, type = StatusMessageType.Instruction })); Dispatcher.Dispatch(EnableAllNavigationAction.From(true)); Dispatcher.Dispatch(SetShowScaleReferenceAction.From(false)); }
void AlignmentView() { // Stop image tracker m_MarkerController.ImageTracker.Stop(); // Show model Dispatcher.Dispatch(ShowBoundingBoxModelAction.From(true)); Dispatcher.Dispatch(ShowModelAction.From(false)); Dispatcher.Dispatch(SetModelScaleAction.From(SetModelScaleAction.ArchitectureScale.OneToOne)); // Show tool for making minor adjustments var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.okButtonValidator = this; // Show complete button toolState.okEnabled = true; toolState.scaleEnabled = false; toolState.rotateEnabled = false; toolState.previousStepEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); // Show button for Re-anchoring to updated image tracker position. Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = k_Alignment, type = StatusMessageType.Instruction })); m_ARModeUIController.StartCoroutine(VisualizeWhenLoaded()); }
void FindTheARFloor() { m_ARModeUIController.ActivePlacementRules(SetModelFloorAction.PlacementRule.FloorPlacementRule); Dispatcher.Dispatch(ShowModelAction.From(false)); Dispatcher.Dispatch(SetARPlacementRuleAction.From(SetModelFloorAction.PlacementRule.FloorPlacementRule)); Dispatcher.Dispatch(ClearStatusAction.From(true)); Dispatcher.Dispatch(ClearStatusAction.From(false)); Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.ARInstructionSidebar)); var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.okEnabled = false; toolState.navigationEnabled = false; toolState.okButtonValidator = this; toolState.previousStepEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionFindTheFloor, type = StatusMessageType.Instruction })); Dispatcher.Dispatch(EnableBimFilterAction.From(false)); Dispatcher.Dispatch(EnableSceneSettingsAction.From(true)); Dispatcher.Dispatch(EnableSunStudyAction.From(false)); Dispatcher.Dispatch(EnableMarkerSettingsAction.From(false)); }
void ConfirmARAnchorPoint() { m_PlacementRuleGameObjectSelector.GetValue().SetActive(false); m_Raycaster.ActiveScanning = false; m_Raycaster.DisableCursor(); var firstARSelectedPlane = m_FirstARSelectedPlaneSelector.GetValue(); var secondARSelectedPlane = m_SecondARSelectedPlaneSelector.GetValue(); var ARFloor = m_ARFloorSelector.GetValue(); // calculate AR anchor point SetARAnchorPointAction.SetARAnchorPointData data; PlanePlaneIntersection(out var unusedPoint, out var lineVec, firstARSelectedPlane.transform.up, firstARSelectedPlane.transform.position, secondARSelectedPlane.transform.up, secondARSelectedPlane.transform.position); // calculate intersect with bottom floor for now LinePlaneIntersection(out data.arPlacementLocation, unusedPoint, lineVec, ARFloor.transform.up, ARFloor.transform.position); // calculate beam height data.beamHeight = Math.Max(firstARSelectedPlane.GetComponent <Renderer>().bounds.size.y, secondARSelectedPlane.GetComponent <Renderer>().bounds.size.y); Dispatcher.Dispatch(SetARAnchorPointAction.From(data)); var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.navigationEnabled = false; toolState.okEnabled = true; toolState.previousStepEnabled = true; toolState.arWallIndicatorsEnabled = true; toolState.arAnchorPointsEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionConfirmARAnchorPoint, type = StatusMessageType.Instruction })); }
void FindTheFloor() { Dispatcher.Dispatch(EnableAllNavigationAction.From(false)); Dispatcher.Dispatch(SetShowScaleReferenceAction.From(true)); Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.ARInstructionSidebar)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionFindAPlaneText, type = StatusMessageType.Instruction })); Dispatcher.Dispatch(ShowBoundingBoxModelAction.From(false)); m_PlacementRuleGameObjectGetter.GetValue().SetActive(true); m_Raycaster.ActiveScanning = true; m_Raycaster.SetViewBasedPlaceMode(false); var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.okEnabled = false; toolState.okButtonValidator = this; toolState.previousStepEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); Dispatcher.Dispatch(EnableBimFilterAction.From(false)); Dispatcher.Dispatch(EnableSceneSettingsAction.From(true)); Dispatcher.Dispatch(EnableSunStudyAction.From(false)); Dispatcher.Dispatch(EnableMarkerSettingsAction.From(false)); }
void ConfirmPlacement() { m_PlacementRuleGameObjectGetter.GetValue().SetActive(false); m_Raycaster.ActiveScanning = false; m_Raycaster.SetViewBasedPlaceMode(true); var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.okEnabled = true; toolState.previousStepEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.ARInstructionSidebar)); Dispatcher.Dispatch(ShowBoundingBoxModelAction.From(true)); Dispatcher.Dispatch(ShowModelAction.From(false)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionAimToPlaceText, type = StatusMessageType.Instruction })); Dispatcher.Dispatch(EnableBimFilterAction.From(false)); Dispatcher.Dispatch(EnableSceneSettingsAction.From(true)); Dispatcher.Dispatch(EnableSunStudyAction.From(false)); Dispatcher.Dispatch(EnableMarkerSettingsAction.From(false)); }
void OnComplete() { m_WalkModeSwitcher.OnWalkStart(); Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.OrbitSidebar)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = k_PlatformDependentPlacementText[SystemInfo.deviceType], type = StatusMessageType.Instruction })); }
void StartInstruction() { Dispatcher.Dispatch(SetInstructionMode.From(true)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = k_PlatformDependentInstructionFindAPlaneText[SystemInfo.deviceType], type = StatusMessageType.Instruction })); Dispatcher.Dispatch(CloseAllDialogsAction.From(null)); SetNavigationState(SetNavigationModeAction.NavigationMode.Walk); }
void ConfirmPlacement() { var modelPlaneContext = m_FirstSelectedPlaneSelector.GetValue().GetComponent <PlaneSelectionContext>().SelectionContextList[0]; var arPlaneNormal = m_FirstARSelectedPlaneSelector.GetValue().transform.up; m_Raycaster.AlignModelWithAnchor(m_BoundinBoxRootSelector.GetValue(), modelPlaneContext.SelectedPlane.normal, arPlaneNormal, m_ModelPlacementLocationSelector.GetValue(), m_ARPlacementLocationSelector.GetValue()); Dispatcher.Dispatch(ShowBoundingBoxModelAction.From(true)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionConfirmPlacementText, type = StatusMessageType.Instruction })); }
void ConfirmAnchorPoint() { Dispatcher.Dispatch(SelectObjectAction.From(new ObjectSelectionInfo())); var arToolStateData = SetARToolStateAction.SetARToolStateData.defaultData; arToolStateData.navigationEnabled = false; arToolStateData.previousStepEnabled = true; arToolStateData.okButtonValidator = this; arToolStateData.wallIndicatorsEnabled = true; arToolStateData.anchorPointsEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(arToolStateData)); Dispatcher.Dispatch(SetActiveToolAction.From(SetActiveToolAction.ToolType.None)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionConfirmAnchorPoint, type = StatusMessageType.Instruction })); }
void FindSecondWall() { Dispatcher.Dispatch(SelectObjectAction.From(new ObjectSelectionInfo())); var arToolState = SetARToolStateAction.SetARToolStateData.defaultData; arToolState.navigationEnabled = false; arToolState.selectionEnabled = true; arToolState.previousStepEnabled = true; arToolState.okButtonValidator = this; arToolState.wallIndicatorsEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(arToolState)); Dispatcher.Dispatch(SetActiveToolAction.From(SetActiveToolAction.ToolType.SelectTool)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionFindSecondWall, type = StatusMessageType.Instruction })); }
void FindSecondARWall() { m_Raycaster.Reset(); m_Raycaster.ActiveScanning = true; m_ARModeUIController.ActivePlacementRules(SetModelFloorAction.PlacementRule.WallPlacementRule); Dispatcher.Dispatch(SetARPlacementRuleAction.From(SetModelFloorAction.PlacementRule.WallPlacementRule)); var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.navigationEnabled = false; toolState.okButtonValidator = this; toolState.previousStepEnabled = true; toolState.arWallIndicatorsEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionFindSecondARWall, type = StatusMessageType.Instruction })); }
void FindModelFloor() { m_PlaneSelector.Orientation = MarsPlaneAlignment.HorizontalUp; Dispatcher.Dispatch(SelectObjectAction.From(new ObjectSelectionInfo())); Dispatcher.Dispatch(SetSpatialSelectorAction.From(m_PlaneSelector)); var arToolState = SetARToolStateAction.SetARToolStateData.defaultData; arToolState.navigationEnabled = false; arToolState.selectionEnabled = true; arToolState.previousStepEnabled = true; arToolState.okButtonValidator = this; Dispatcher.Dispatch(SetARToolStateAction.From(arToolState)); Dispatcher.Dispatch(SetActiveToolAction.From(SetActiveToolAction.ToolType.SelectTool)); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionFindModelFloor, type = StatusMessageType.Instruction })); }
void OnMeasureToolButtonClicked() { // Helpmode if (HelpDialogController.SetHelpID(SetHelpModeIDAction.HelpModeEntryID.MeasureTool)) { return; } var toggleData = ToggleMeasureToolAction.ToggleMeasureToolData.defaultData; toggleData.toolState = !m_MeasureToolStateSelector.GetValue(); if (toggleData.toolState) { if (m_ActiveToolSelector.GetValue() == SetActiveToolAction.ToolType.SelectTool && ((ObjectSelectionInfo)m_ObjectSelectionInfoSelector.GetValue()).CurrentSelectedObject() == null) { Dispatcher.Dispatch(SetActiveToolAction.From(SetActiveToolAction.ToolType.None)); Dispatcher.Dispatch(OpenSubDialogAction.From(OpenDialogAction.DialogType.None)); } Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = MeasureToolUIController.instructionStart, type = StatusMessageType.Instruction })); } else { Dispatcher.Dispatch(ClearStatusAction.From(true)); Dispatcher.Dispatch(ClearStatusAction.From(false)); } Dispatcher.Dispatch(ToggleMeasureToolAction.From(toggleData)); // To initialize Anchor Dispatcher.Dispatch(SetSpatialSelectorAction.From(m_ObjectSelector)); if (m_SelectButton.selected) { Dispatcher.Dispatch(SetActiveToolAction.From(SetActiveToolAction.ToolType.None)); Dispatcher.Dispatch(OpenSubDialogAction.From(OpenDialogAction.DialogType.None)); } }
void FindTheFloor() { m_PlacementRuleGameObjectSelector.GetValue().SetActive(true); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionFindAPlaneText, type = StatusMessageType.Instruction })); m_Raycaster.ActiveScanning = true; Dispatcher.Dispatch(ShowBoundingBoxModelAction.From(false)); var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.okEnabled = false; toolState.okButtonValidator = this; toolState.scaleEnabled = false; toolState.rotateEnabled = false; toolState.selectionEnabled = false; toolState.measureToolEnabled = false; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); }
void OnPickPointerAsyncCallback(List <Tuple <GameObject, RaycastHit> > results) { if (results == null || results.Count == 0) { Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = MeasureToolUIController.instructionTapOnSurface, type = StatusMessageType.Instruction })); return; } SelectObjectMeasureToolAction.IAnchor selectedAnchor = null; var selectedObjects = results.Select(x => x.Item1).Where(x => x.layer != MetadataFilter.k_OtherLayer); var selectedAnchorsContext = selectedObjects.Select(r => r.GetComponent <AnchorSelectionContext>()).Where(g => g != null).ToList(); if (selectedAnchorsContext.Count > 0) { selectedAnchor = selectedAnchorsContext[0].LastContext.selectedAnchor; } Dispatcher.Dispatch(SelectObjectMeasureToolAction.From(selectedAnchor)); Dispatcher.Dispatch(ClearStatusAction.From(true)); Dispatcher.Dispatch(ClearStatusAction.From(false)); if (m_MeasureModeGetter() == ToggleMeasureToolAction.MeasureMode.PerpendicularDistance && m_AnchorsList.Count == 1) { Ray ray = new Ray(); var firstAnchor = selectedAnchorsContext[0].LastContext.selectedAnchor; if (firstAnchor.type == ToggleMeasureToolAction.AnchorType.Point) { var anc = ((PointAnchor)firstAnchor); ray.origin = anc.position; ray.direction = anc.normal; } AnchorPicker.Pick(ray, OnPickPerpendicularAsyncCallback); } }
void AnchoringView() { var instruction = $"Locate anchor for {m_MarkerController.ActiveMarker.Name}, then press Ok."; Dispatcher.Dispatch(SetStatusMessageWithType.From(new StatusMessageData { text = instruction, type = StatusMessageType.Instruction })); var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.okButtonValidator = null; toolState.okEnabled = false; toolState.scaleEnabled = false; toolState.rotateEnabled = false; toolState.previousStepEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.ARInstructionSidebar)); Dispatcher.Dispatch(ShowModelAction.From(false)); Dispatcher.Dispatch(EnableBimFilterAction.From(false)); Dispatcher.Dispatch(EnableSceneSettingsAction.From(false)); Dispatcher.Dispatch(EnableSunStudyAction.From(false)); Dispatcher.Dispatch(EnableMarkerSettingsAction.From(false)); Dispatcher.Dispatch(SetAREnabledAction.From(true)); Dispatcher.Dispatch(SetARPlacementRuleAction.From(SetModelFloorAction.PlacementRule.MarkerPlacementRule)); // Run image tracking, watch for a target // Show accept button when a target is available. m_MarkerController.ImageTracker.OnTrackedFound += HandleTrackableFound; m_MarkerController.ImageTracker.OnTrackedPositionUpdate += HandleTrackableUpdate; m_PlacementRuleGameObjectSelector.GetValue().SetActive(false); m_MarkerController.ImageTracker.Run(); }
void AlignModelView() { m_Raycaster.Reset(); if (m_PlacementRuleGameObjectGetter.GetValue() != null) { m_PlacementRuleGameObjectGetter.GetValue().SetActive(false); } m_Raycaster.ActiveScanning = false; m_Raycaster.DisableCursor(); Dispatcher.Dispatch(SetStatusMessageWithType.From( new StatusMessageData() { text = m_InstructionAlignModelView, type = StatusMessageType.Instruction })); Dispatcher.Dispatch(SetActiveToolBarAction.From(SetActiveToolBarAction.ToolbarType.ARModelAlignSidebar)); var toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.okEnabled = false; toolState.selectionEnabled = true; toolState.measureToolEnabled = true; toolState.cancelEnabled = true; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); toolState = SetARToolStateAction.SetARToolStateData.defaultData; toolState.navigationEnabled = true; toolState.okEnabled = true; toolState.scaleEnabled = false; toolState.rotateEnabled = false; Dispatcher.Dispatch(SetARToolStateAction.From(toolState)); Dispatcher.Dispatch(EnableAllNavigationAction.From(true)); Dispatcher.Dispatch(SetShowScaleReferenceAction.From(false)); Dispatcher.Dispatch(EnableBimFilterAction.From(true)); Dispatcher.Dispatch(EnableSceneSettingsAction.From(true)); Dispatcher.Dispatch(EnableSunStudyAction.From(false)); Dispatcher.Dispatch(EnableMarkerSettingsAction.From(false)); }