void Update() { if (laser.isHit()) { snapObjScript = laser.getHitObject().GetComponent <SnapObject>(); } else { snapObjScript = null; } if (snapObjScript != null && snapObjScript.isSnap()) { laser.setSnapPoint(snapObjScript.getSnapPt(laser.getHitPoint())); } else { laser.clearSnappedPoint(); } // highlight object being edited if edit mode is on or the pointed object hitAppObj = GeneralSettings.editOn() ? GeneralSettings.getEditObject() : GeneralSettings.getParentClone(laser.getHitObject(), "app_"); if (hitAppObj != null) { hitAppObj.GetComponent <Highlightable>().highlightObject(); } // actions in selection mode if (am == null) { selActionMethods(); return; } am.amUpdate(laser); cm.cmUpdate(laser); }
// strokes are updated in the buffer only for display private void updateStroke(LaserPicker laser) { if (!laser.isHit()) { return; } currPoints.Add(laser.getTerminalPoint()); Vector3[] currPtsArray = currPoints.ToArray(); currentStrokeDisplayBufferLineRenderer.numPositions = currPtsArray.Length; currentStrokeDisplayBufferLineRenderer.SetPositions(currPtsArray); }
private void getStartPos(LaserPicker laser) { if (WandControlsManager.WandControllerRight.getTriggerDown()) { if (laser.isHit()) { startPos = laser.getTerminalPoint(); actionMode = ActionMode.SELVEC1; GeneralSettings.updateInteractText("Please select the distance between the elements for the array."); } } }
//--------------------------------------------------------------- private void getSelObj(LaserPicker laser) { if (WandControlsManager.WandControllerRight.getTriggerDown()) { if (laser.isHit()) { arrObj = GeneralSettings.getParentClone(laser.getHitObject(), "app_"); actionMode = ActionMode.SELSTART; GeneralSettings.updateInteractText("Please select the center point for the array."); } } }
private void getStartPos(LaserPicker laser) { if (WandControlsManager.WandControllerRight.getTriggerDown()) { if (laser.isHit()) { startPos = laser.getTerminalPoint(); actionMode = ActionMode.SELVEC1; GeneralSettings.updateInteractText("Please select vector in first direction for array."); } } }
public void amUpdate(LaserPicker laser) { if (hostSurface != null) { if (WandControlsManager.WandControllerRight.getTriggerDown()) { if (laser.isHit()) { Vector3 pt = laser.getHitPoint(); lastPt = Instantiate(pointMarker, pt, Quaternion.identity); selectedPtObjects.Add(lastPt); if (selectedPtObjects.Count == 4) { List <Vector3> pts = new List <Vector3>(); foreach (GameObject ptObj in selectedPtObjects) { pts.Add(ptObj.transform.position); } GameObject newSrf = Instantiate(app_Surface, laser.getHitPoint(), Quaternion.identity); newSrf.GetComponent <app_Surface>().init(pts); hostSurface.GetComponent <app_Plane>().enhostObject(newSrf); GeneralSettings.updateInteractText(""); GeneralSettings.addLineToConsole(string.Format("{0} surface created under {1} host plane.", newSrf.name, hostSurface.name)); clearPointCollectionMode(laser); return; } GeneralSettings.updateInteractText(string.Format("Pick {0} more points to complete the surafce.", 4 - selectedPtObjects.Count)); } } if (WandControlsManager.WandControllerRight.getGripDown()) { clearPointCollectionMode(laser); GeneralSettings.addLineToConsole("Surface creation exited."); GeneralSettings.updateInteractText("Please select a plane to act as host for the surface."); } return; } if (WandControlsManager.WandControllerRight.getTriggerDown()) { hostSurface = laser.getHitObject(); laser.setRestrictedObject(hostSurface); GeneralSettings.updateInteractText("Select 4 corner points for surface."); GeneralSettings.addLineToConsole(string.Format("{0} selected as host plane for surface to be created.", hostSurface.name)); } }
public void amUpdate(LaserPicker laser) { if (laser.isHit()) { if (WandControlsManager.WandControllerRight.getTriggerPressed()) { if (GeneralSettings.getParentRecursive(laser.getHitObject(), "_RefObjects", "app_") != null) { // move the current refObject along the plane contained as a reference among the siblings } } } }
private void getVec1(LaserPicker laser) { if (WandControlsManager.WandControllerRight.getTriggerDown()) { if (laser.isHit()) { vec1 = laser.getTerminalPoint() - startPos; actionMode = ActionMode.POLARCOUNT; currWaitingObj = ScriptableObject.CreateInstance <WaitingObject>(); GeneralSettings.setNumPad(currWaitingObj); GeneralSettings.updateInteractText("Please specify number of poles in polar array."); } } }
private void liveMeasureUpdate() { if (l.isHit()) { distM = l.getHitDistance().ToString("F1"); distF = getDistInFeet(l.getHitDistance()); measuredText = distM + " m | " + distF + " ft"; measurementTextUI.text = measuredText; } else { measurementTextUI.text = defaultText; } }