- Home /
Question by
IgorUnity3D · Jul 24, 2015 at 10:41 AM ·
rotationtransformangle
Unity - Decrease/Increase the "Z axis" angle axis on Update()
What is the best way to Decrease/Increase an angle without using "eulerAngles"?
I need turn my transform between 30 and 325, according to my "Y axis".
If it is less than zero we reduce the value of "Z axis" is greater if we increase the value of "Z axis".
I already tried:
if ( airPlanePlayerRigidbody2D.velocity.y < 0 ) {
var rotationVector = airPlanePlayerTransform.rotation;
rotationVector.z -= 2f;
Vector3 vec = new Vector3(rotationVector.x,rotationVector.y,rotationVector.z);
airPlanePlayerTransform.rotation = Quaternion.Euler(vec);
}
And:
public void Rotate(float angle)
{
airPlanePlayerTransform.Rotate(0, 0, angle); // this rotate forever
}
Thank you in advance.
air-angle.jpg
(45.2 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220611232815im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Problems caused by non-unique Euler angle solutions 1 Answer
Rotate angle 0 Answers
Rotate an object around another object at an angle from the X axis? 1 Answer
Make an object move to a given point by rotating to the correct direction first. 1 Answer
How can I multiply the rotation of a mirrored object? 1 Answer