#Use ``eulerAngles`` whenever you need to
1 messages · Page 1 of 1 (latest)
I tried it. the up-limit work well, but the down limit doesn't work
void Rotation()
{
float angleZ = transform.eulerAngles.z;
if (verticalInput == 1 && angleZ <= 34f)
{
transform.rotation *= anguloW;
}
if( verticalInput == -1 && angleZ >= -34f)
{
transform.rotation *= anguloS;
}
Implement this:
#💻┃code-beginner message
It sets the angle to be closest angle from 0, so it is in the -180 to 180 range
thanks
one more thing when I establish the "AnguloW " and the "AngulosS", the inspector writes it betwen 0 to 360 angles, is there a better way to write it?
Inspector kind of shows its own numbers
Because Unity uses the Quaternion data type to store rotations
But Euler angles (Vector3) can't represent that fully
the problem is that I write (0,0, -10f); and it rotates counterclockwise
When I need it to rotate clockwise
I am trying it 😅
public Quaternion anguloW = Quaternion.Euler(0f, 0f, -10f);
public Quaternion anguloS = Quaternion.Euler(0f, 0f, 10f);
the W rotates faster than the S rotation
@dense snow
?