//!
 //! scale currently selected object with joystick input
 //! @param      scale     new scale of object
 //!
 public void scaleSelectionJoystick(Vector3 scale)
 {
     if (currentSelection)
     {
         // lights (scalemode is used for light parameters intensity and range)
         SceneObjectLight scl = currentSelection.GetComponent <SceneObjectLight>();
         if (scl)
         {
             // set light intensity
             scl.setLightIntensity(scl.getLightIntensity() + (scale.z * 0.5f));
             // set gui element
             scl.setLightRange(scl.getLightRange() + (scale.y * 0.5f));
             if (scale.z == 0.0f)
             {
                 UIAdapter.updateRangeSlider(scl.getLightRange());
             }
             else if (scale.y == 0.0f)
             {
                 UIAdapter.updateRangeSlider(scl.getLightIntensity());
             }
         }
         // objects
         else
         {
             if (scale.x == 0 && scale.y == 0)
             {
                 axisLocker = new Vector3(0, 0, 1);
             }
             else if (scale.x == 0 && scale.z == 0)
             {
                 axisLocker = new Vector3(0, 1, 0);
             }
             else if (scale.y == 0 && scale.z == 0)
             {
                 axisLocker = new Vector3(1, 0, 0);
             }
             else if (scale.x != 0 && scale.y != 0 && scale.z != 0)
             {
                 axisLocker = new Vector3(1, 1, 1);
                 scale      = Vector3.one * scale.x;
             }
             if (!currentSelection.transform.parent.transform.GetComponent <Light>())
             {
                 float scaleFactor = (8f * Vector3.Distance(Camera.main.transform.position, currentSelection.position) / VPETSettings.Instance.maxExtend);
                 currentSelection.transform.localScale += Vector3.Scale(scale / currentSelection.transform.parent.lossyScale.x * scaleFactor / VPETSettings.Instance.controllerSpeed, axisLocker) / 100f;
                 if (liveMode)
                 {
                     serverAdapter.SendObjectUpdate(currentSelection.GetComponent <SceneObject>(), ParameterType.SCALE);
                 }
             }
         }
     }
 }
Beispiel #2
0
 private void updateIntensity(float intensity)
 {
     currentLight.setLightIntensity(intensity);
 }