# Thread: Any method to get the angle?

1. ## Any method to get the angle?

I use the function---glRotatef() to rotate the model, and now I want to know whether the angle which the model rotated is right or not, so I wonder if there any method to get the angle the model actually rotate? Anyone who knows about it please tell me! Thank you very much!

2. ## Re: Any method to get the angle?

you could try this:

Code :
```float oldy = yrot;
glRotatef(xrot,yrot,zrot);
//say you want to know the rotation of the y axis:

if (oldy >= yrot) {
//then you know that it turnes right
}
if (oldy <= yrot) {
//then you know that it turned left
}```

3. ## Re: Any method to get the angle?

Woops, After reading your question further i realized that you eman right as in correct, I thought you meant right as in direction. lol.

you could try this:

Code :
```
glRotatef(angle, 0.0f, 1.0f, 0.0f);

//here the float [B]angle[/B]  is the angle of rotation```
or if you want to know the difference between rotation:

Code :
```float oldangle = angle;
float amrot;
glRotatef(angle, 0.0f, 1.0f, 0.0f);

if (oldangle == angle) {
//rotation didn't change
}
elsif (oldangle >= angle) {
//then it rotated left
amrot = oldangle - angle;
//amrot equals the amount of rotation
}
else {
//Obviously if it didn't stay still, or rot left, then it must have rotated right

amrot = angle - oldangle;
}```
If you need any more help or information about the code that I dumped here just ask...

Hope this helps...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•