public void changeshape() { UIchange(); //Remove old item from display objectParameters[currentShape].SetActive(false); testRod.getRepresentation().SetActive(false); //Collect required information to put onto new item float temp1 = lengthBar.transform.GetChild(0).GetComponent <Slider>().value; int temp2 = mat.GetComponent <Dropdown>().value; //get current item currentShape = selectedShape.GetComponent <Dropdown>().value; testRod = testRods[currentShape].GetComponent <TortionRod>(); testRod.changeSubmenu(submenu); submenu.value = 0; //Turn new item on objectParameters[currentShape].SetActive(true); testRod.getRepresentation().gameObject.SetActive(true); testRod.activesliders(); //Correct for values to be transfered over lengthBar.transform.GetChild(0).GetComponent <Slider>().value = temp1; mat.GetComponent <Dropdown>().value = temp2; float d1 = dimentions.transform.GetChild(0).GetChild(0).GetComponent <Slider>().value; dimentions.transform.GetChild(1).GetChild(0).GetComponent <Slider>().value = d1; updateLength(); updateMaterial(); changeIn_submenu(); updateShearStress(); testRod.update(); }
void Start() { currentShape = 0; mat.value = 0; currentMaterial = 0; /**/ foreach (GameObject o in objectParameters) { o.SetActive(false); } objectParameters[currentShape].SetActive(true); /**/ testRod = testRods[currentShape].GetComponent <TortionRod>(); testRod.changeSubmenu(submenu); submenu.value = 0; /**/ foreach (GameObject x in testRods) { // x.SetActive(false); //x.transform.localScale = new Vector3(1, 1, 1); x.GetComponent <TortionRod>().setdefaultSkin(materials[currentMaterial], 21); x.GetComponent <TortionRod>().reset(); } defaultJointRotation = testRod.getRepresentation().transform.GetChild(0).GetChild(0).transform.rotation; /**/ testRod.getRepresentation().SetActive(true); updateRod(); controls.SetActive(true); chm.MoveCamera(stationCamera); chm.setOrthographic(true); chm.setOrthoSize(0.2f); // chm.setOrthographic(false); }