I'm using a slider to rotate an object on the z axis. The slider has a value of 1-360 (Whole Numbers); when the slider is moved, I use that value for the eulerAngles z axis value. (NOTE: The object is part of a child/parent 'string' of instantiated objects and it should only ever rotate on the local z axis). This method is working for some objects in the 'string', but not others. When it's not working, the object I'm trying to rotate spins wildly on the z axis because the objects z value is not a reflection of the slider value (I tested this in the inspector). I can't figure where these 'random' slider values are coming from.
Here is the rotation function I'm using for the sliders On Value Change event:
public void SliderRotate () {
Target.transform.eulerAngles = new Vector3(
Target.transform.eulerAngles.x,
Target.transform.eulerAngles.y,
mySlider.GetComponent<Slider> ().value);
}
BTW - If I change the x and y values to zero, the problem goes away. However, the objects then loose their correct orientation to their parent (I need the x and y to stay where they are).
Thanks in advance for any insight you can offer into this issue.
Windows - Unity 5.3.5f1
Here is an image that might help clarify: