// Use this for initialization void Start() { InteractablePolygon iPoly = GeoObjConstruction.rPoly(5, .2f, Vector3.up * 1.8f, Vector3.up); ProjectedPolygon pPoly = iPoly.gameObject.AddComponent <ProjectedPolygon>(); pPoly.Initialize(); }
private void Start() { sidesForPyramids = new List <AbstractPolygon>(); myPyramids = new List <DependentPyramid>(); myPrism = GeoObjConstruction.iPrism(GeoObjConstruction.rPoly(nSides, apothem, Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height1), Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height2); myPrism.LeapInteraction = false; foreach (AbstractLineSegment mgo in myPrism.allEdges) { mgo.LeapInteraction = false; } foreach (AbstractPolygon mgo in myPrism.allfaces) { mgo.LeapInteraction = false; foreach (AbstractPoint mgol2 in mgo.pointList) { mgol2.LeapInteraction = false; } } foreach (AbstractPolygon side in myPrism.sides) { sidesForPyramids.Add(side); } sidesForPyramids.Add(myPrism.bases[0]); myApex = GeoObjConstruction.iPoint(Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height2); //restrict the movement of myApex. flatface1 = flatlandSurface.Constructor(); flatface1.GetComponent <MeshRenderer>().materials[0].color = Color.clear; flatface1.attachedObjs.Add(myApex); foreach (AbstractPolygon side in sidesForPyramids) { myPyramids.Add(GeoObjConstruction.dPyramid(side, myApex)); } for (int i = 0; i < myPyramids.Count; i++) { foreach (AbstractPolygon face in myPyramids[i].allfaces) { face.figColor = mgoColor[i]; face.LeapInteraction = false; } foreach (AbstractLineSegment line in myPyramids[i].allEdges) { line.LeapInteraction = false; } foreach (AbstractPoint point in myPyramids[i].basePolygon.pointList) { point.LeapInteraction = false; } } foreach (DependentPyramid pyramid in myPyramids) { pyramid.GetComponent <InteractionBehaviour>().OnHoverBegin += updateGlow; pyramid.GetComponent <InteractionBehaviour>().OnHoverEnd += updateGlow; } }
private void Start() { myPrism = GeoObjConstruction.iPrism(GeoObjConstruction.rPoly(nSides, Mathf.Abs(height1 - height2) / 2f, Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height1), Vector3.ProjectOnPlane(this.transform.position, Vector3.up) + Vector3.up * height2); myPrism.LeapInteraction = false; foreach (AbstractLineSegment mgo in myPrism.allEdges) { mgo.LeapInteraction = false; } foreach (AbstractPolygon mgo in myPrism.bases) { mgo.LeapInteraction = false; foreach (AbstractPoint mgol2 in mgo.pointList) { mgol2.LeapInteraction = false; } } foreach (AbstractPolygon face in myPrism.allfaces) { face.figColor = mgoColor; } //pyramid 1 - base ABC - apex D myPyramids.Add(GeoObjConstruction.dPyramid(myPrism.bases[0], myPrism.bases[1].pointList[0])); //pyramid 2 - base DEF - apex C myPyramids.Add(GeoObjConstruction.dPyramid(myPrism.bases[1], myPrism.bases[0].pointList[2])); //pyramid 3 - base CBD - apex E myPyramids.Add(GeoObjConstruction.dPyramid(myPyramids[0].sides[1], myPrism.bases[1].pointList[1])); foreach (DependentPyramid pyramid in myPyramids) { pyramid.GetComponent <InteractionBehaviour>().OnHoverBegin += updateGlow; pyramid.GetComponent <InteractionBehaviour>().OnHoverEnd += updateGlow; } }
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); }