Jump to content
  • Advertisement
Sign in to follow this  
Prog101

arranging the hud degrees

This topic is 3972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi there guys this may be a simple problem some of you have done before i am trying to get the angles correct for my hud, it is just a round dial with a needle that shows the speed i am going , the speed is calculated from a 0 - 1 range the initial 0 position is 178 degrees the end 1 position is 110 degrees so there is a 68 degree difference from start to end. how can a work out the current angle needed if say fuel was 0.5?

Share this post


Link to post
Share on other sites
Advertisement
Linear interpolation: w = u + (1 - t) * (v - u)
where
w = the angle representing the current speed
u = the angle representing the minimum speed
v = the angle representing the maximum speed
t = the current speed on a normalized 0 - 1 scale

So for a [178, 110] angular range and a current speed of 0.5:
w = 178 + (1 - 0.5) * (110 - 178)
= 178 + 0.5 * -68
= 178 - 34
= 144

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!