- Home /
Question by
Xavier78 · Apr 04, 2014 at 01:38 AM ·
rotationquaternionspaceself
Rotate from HorizantalSlider in local not global help.
Okay hoping this will be easy for some one to answer, i have this script that will rotate an object from the slider, but the parent object will also be rotating, and for some reason it isn't rotating on local, just global, but with the parent also spinning i need it only to be local.
function Update()
{
if (hSliderValue != oldh)
{
transform.rotation = Quaternion.identity;
transform.Rotate(0, hSliderValue, 0,Space.Self);
oldh = hSliderValue;
}
}
function OnGUI () {
hSliderValue = GUI.HorizontalSlider (Rect (5,Screen.height - 40, 200, 30), hSliderValue, 0, 270);
}
Comment
Best Answer
Answer by robertbu · Apr 04, 2014 at 05:20 AM
Your exact condition and behavior is unclear. You may be able to get what you want by changing line 5 to:
transform.localRotation = Quaternion.identity;