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)); } }
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); }
// Update is called once per frame void Update() { // teleport if (WandControlsManager.WandControllerLeft.getTriggerDown()) { if (leftLaser.isOn()) { GeneralSettings.fadeScreen(); StartCoroutine(teleportToPoint(leftLaser.getHitPoint())); } } // fly if (WandControlsManager.WandControllerLeft.getGripPressed()) { Vector3 moveVector = (leftWand.transform.forward * moveSpeed); transform.Translate(moveVector); } }