Esempio n. 1
0
 void Start()
 {
     Physics.gravity = 19.6f * Vector3.down;
     Time.timeScale  = 0f;
     selected        = Camera.main.GetComponent <CameraController>().center;
     selectedExists  = false;
     camRayLength    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>().camRayLength;
     if (relativeRotation)
     {
         RXinitial = RX.transform.rotation;
         RYinitial = RY.transform.rotation;
         RZinitial = RZ.transform.rotation;
     }
     X.SetActive(true); Y.SetActive(true); Z.SetActive(true); RX.SetActive(true); RY.SetActive(true); RZ.SetActive(true);
     X.GetComponentInChildren <Renderer>().material.color  = Color.red;
     Y.GetComponentInChildren <Renderer>().material.color  = Color.green;
     Z.GetComponentInChildren <Renderer>().material.color  = Color.blue;
     RX.GetComponentInChildren <Renderer>().material.color = Color.red;
     RY.GetComponentInChildren <Renderer>().material.color = Color.green;
     RZ.GetComponentInChildren <Renderer>().material.color = Color.blue;
 }
Esempio n. 2
0
 void align_tools()
 {
     X.SetActive(mode == "t" & selectedExists);
     Y.SetActive(mode == "t" & selectedExists);
     Z.SetActive(mode == "t" & selectedExists);
     RX.SetActive(mode == "r" & selectedExists);
     RY.SetActive(mode == "r" & selectedExists);
     RZ.SetActive(mode == "r" & selectedExists);
     if (selectedExists)
     {
         X.transform.position  = selected.transform.position;
         Y.transform.position  = selected.transform.position;
         Z.transform.position  = selected.transform.position;
         RX.transform.position = selected.transform.position;
         RY.transform.position = selected.transform.position;
         RZ.transform.position = selected.transform.position;
         if (relativeRotation)
         {
             RX.transform.rotation = selected.transform.rotation * RXinitial;
             RY.transform.rotation = selected.transform.rotation * RYinitial;
             RZ.transform.rotation = selected.transform.rotation * RZinitial;
         }
     }
 }