internal void Start() { shearingLabManager labMan = FindObjectOfType <shearingLabManager>(); labMan.measurementDisplays.Add(surfaceAreaModel.transform); labMan.measurementDisplays.Add(volumeModel.transform); //labMan.measurementDisplays.Add(crossSectionModel.transform); labMan.disableDisplays(); surfaceAreaModel.GetComponent <MeshRenderer>().materials[0].color = mgoColor; volumeModel.GetComponent <MeshRenderer>().materials[0].color = mgoColor; crossSectionModel.GetComponent <MeshRenderer>().materials[0].color = mgoColor; //copy into base scene on Load. //this.transform.parent = SceneManager.GetSceneByName("HandWaverBase").GetRootGameObjects()[0].transform.parent; //construct parallel planes flatface1 = flatlandSurface.Constructor(); flatface2 = flatlandSurface.Constructor(); flatface1.otherFlatlandSurface = flatface2; flatface2.otherFlatlandSurface = flatface1; flatface1.transform.localScale = new Vector3(3f, .0001f, 3f); flatface2.transform.localScale = new Vector3(3f, .0001f, 3f); AbstractPoint apexPoint = GeoObjConstruction.iPoint(Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height2); AbstractPolygon basePoly = GeoObjConstruction.rPoly(nSides, .3f, Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height1); myPyramid = GeoObjConstruction.dPyramid(basePoly, apexPoint); foreach (AbstractLineSegment line in myPyramid.allEdges) { line.LeapInteraction = false; } foreach (AbstractPoint point in basePoly.pointList) { point.LeapInteraction = false; flatface1.attachedObjs.Add(point); } foreach (AbstractPolygon face in myPyramid.allfaces) { face.LeapInteraction = false; } flatface2.attachedObjs.Add(apexPoint); flatface2.attachedObjs.Add(basePoly); myPyramid.GetComponent <InteractionBehaviour>().enabled = false; mf.transform.position = Vector3.zero; mf.transform.localScale = Vector3.one; mf.transform.rotation = Quaternion.identity; palmDetectors = GetComponentsInChildren <PalmDirectionDetector>(); //NATHAN HELP ME HERE for (int i = 0; i < palmDetectors.Length; i++) { PalmDirectionDetector palm = palmDetectors[i]; palm.OnActivate.AddListener(startUpdateMesh); palm.OnDeactivate.AddListener(endUpdateMesh); ExtendedFingerDetector finger = palm.GetComponent <ExtendedFingerDetector>(); finger.OnDeactivate.AddListener(endUpdateMesh); //the extended finger detectors are set to enable/disable the respective PalmDirectionDetectors. switch (i) { case 0: palm.HandModel = leapHandDataLogger.ins.currHands.Lhand_rigged; finger.HandModel = leapHandDataLogger.ins.currHands.Lhand_rigged; break; case 1: palm.HandModel = leapHandDataLogger.ins.currHands.RHand_rigged; finger.HandModel = leapHandDataLogger.ins.currHands.RHand_rigged; break; default: break; } } updateMesh = updateMeshRoutine(); if (overrideHandInput) { startUpdateMesh(); } foreach (AbstractPolygon face in myPyramid.allfaces) { face.figColor = mgoColor; } myPyramid.apex.GetComponent <InteractionBehaviour>().OnGraspEnd += constantVelOutOfRange; labMan.addApexToList(myPyramid.apex); }
internal void Start() { shearingLabManager labMan = FindObjectOfType <shearingLabManager>(); labMan.measurementDisplays.Add(areaModel.transform); labMan.measurementDisplays.Add(perimeterModel.transform); //labMan.measurementDisplays.Add(crossSectionModel.transform); labMan.disableDisplays(); areaModel.GetComponent <MeshRenderer>().materials[0].color = mgoColor; perimeterModel.GetComponent <LineRenderer>().materials[0].color = mgoColor; crossSectionModel.GetComponent <LineRenderer>().materials[0].color = mgoColor; line1 = parallelLines.Constructor(); parallelLines line2 = parallelLines.Constructor(); line1.Position3 = Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height2; line2.Position3 = Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height1; line1.otherLine = line2; line2.otherLine = line1; AbstractPoint p1 = GeoObjConstruction.iPoint(line1.Position3); AbstractPoint p2 = GeoObjConstruction.iPoint(line2.Position3); AbstractPoint p3 = GeoObjConstruction.iPoint(line2.Position3 + line2.normalDir * 0.3f); p1.GetComponent <InteractionBehaviour>().OnGraspedMovement += checkOutOfRange; p1.GetComponent <InteractionBehaviour>().OnGraspEnd += constantVelOutOfRange; labMan.addApexToList(p1); //line not on Parallel l1 = GeoObjConstruction.dLineSegment(p1, p2); //line not on parallel l2 = GeoObjConstruction.dLineSegment(p1, p3); //line on parallel AbstractLineSegment l3 = GeoObjConstruction.dLineSegment(p3, p2); line1.attachedObjs.Add(p1); line2.attachedObjs.Add(p2); line2.attachedObjs.Add(p3); points.Add(p1); points.Add(p2); points.Add(p3); lines.Add(l1); lines.Add(l2); lines.Add(l3); triangle = GeoObjConstruction.dPolygon(lines, points); foreach (AbstractLineSegment line in lines) { line.GetComponent <InteractionBehaviour>().enabled = false; } triangle.GetComponent <InteractionBehaviour>().enabled = false; myLR = GetComponent <LineRenderer>(); palmDetectors = GetComponentsInChildren <PalmDirectionDetector>(); for (int i = 0; i < palmDetectors.Length; i++) { PalmDirectionDetector palm = palmDetectors[i]; palm.OnActivate.AddListener(startUpdateMesh); palm.OnDeactivate.AddListener(endUpdateMesh); ExtendedFingerDetector finger = palm.GetComponent <ExtendedFingerDetector>(); finger.OnDeactivate.AddListener(endUpdateMesh); switch (i) { case 0: palm.HandModel = leapHandDataLogger.ins.currHands.Lhand_rigged; finger.HandModel = leapHandDataLogger.ins.currHands.Lhand_rigged; break; case 1: palm.HandModel = leapHandDataLogger.ins.currHands.RHand_rigged; finger.HandModel = leapHandDataLogger.ins.currHands.RHand_rigged; break; default: break; } //the extended finger detectors are set to enable/disable the respective PalmDirectionDetectors. } updateLR = updateLR_Routine(); if (overridePalmDetector) { startUpdateMesh(); } triangle.figColor = mgoColor; movePointOnLine = animatePoint(points[0]); }