Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / X Camera rotation(Silly question)

Author
Message
FERSIS
18
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 4th Dec 2008 16:09
Hello.
Im trying to rotate the X angle of a camera from one angle to another, and i want to learn how to determine in which direction the camera should rotate.

IE:
Current Camera angle X: 5º
Target Camera angle X: 330º

If i increment 5º until i get 330º the camera will make a long rotation, so what i want is to decrement until i get 330º
(5,4,3,2,1,360,359,etc etc) so the camera rotation is shorter.

IE2:
Current Camera angle X: 90º
Target Camera angle X: 200º

In this case i want to increment from 90º to 200º

What i want to know is how to determine if i have to increment or decrement to get the shorter rotation of the camera.

This question was really hard to write


Sorry for my english.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 4th Dec 2008 17:12 Edited at: 4th Dec 2008 17:14
Since your turn will always be less than/equal to half way around, you don't want to turn any more than 180 degrees. Secondly, you want to be sure that you're angles are in 'simplest form.'


Now, as for finding the direction, you'll need to know the difference of the two angles. For simplicity of calculation, it's best to use the absolute value.


Or something to that effect. By the way, what language do you normally speak?


My site, for various stuff that I make.
FERSIS
18
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 4th Dec 2008 17:28
Thanks for the snippet i will try it.

Spanish is my native language and i never studied english.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 4th Dec 2008 17:39
Your english is decent. I was only asking because I happen to know french, and it seems there are a lot of french speakers on this forum.


My site, for various stuff that I make.
FERSIS
18
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 4th Dec 2008 18:34
Here is a little example i did with your snippet:

Login to post a reply

Server time is: 2024-11-25 07:24:55
Your offset time is: 2024-11-25 07:24:55