Answers for "How to rotate only Y Axis??"
http://answers.unity.com/questions/1577475/how-to-rotate-only-y-axis.html
The latest answers for the question "How to rotate only Y Axis??"Answer by AndhireCo
http://answers.unity.com/answers/1577819/view.html
float angle= 0;
if (joystick.Horizontal > 0)
{
angle= 90;
angle-= 90 * joystick.Vertical;
}
else
{
angle= -90;
angle+= 90 * joystick.Vertical;
}
Vector3 v = new Vector3(0, angle, 0);
transform.localRotation = Quaternion.Euler(v);
Finally i got it. A friend help me to do it. <br><br>
First we declare the angle to 0 and we check if our joystick is moving horizontal. <br><br>
When it is bigger than 0 ( it means that the joystick is moving to the right ) so the angle to move my object to right is 90. So i put it 90 then that angle i subtract 90 * joystick.Vertical
<br>
So according to my angle that i expect to move in that way that is between 90 to 180 and 0. So only we need to multiply to the value of the vertical that it is between 1 to -1. So if it is positive, it means that the stick is moving up. And with the other is the same way.
<br><br>
Finally i get the angle to a vector3. That i make a Quaternion.Euler to make the rotation and i assign it to the rotation to my object.Tue, 04 Dec 2018 23:51:49 GMTAndhireCo