Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OpenGL_Guru

OpenGL OpenGL Compass

This topic is 5305 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

i now have my terrain rendered out and have some ideas about making a compass, starting by facing North.. there are many ideas out there on how to do this by googling.. was just wanting to know your opinion on maybe the best way to do this and at the same time making it look good..thanks...

Share this post


Link to post
Share on other sites
Advertisement
maybe you could use the look vector of your avatar (that is holding the compas) and define a north vector (maybe {0,0,-1} or something) and then use the angle between these to vectors to compute the value on the compas (I dont know how compas'' work... cuz i faild scouts ).

Share this post


Link to post
Share on other sites
well i was thinking of just making a 3-D compass, 4 ends, one with N, E, S, W. then as you turn in the 3d world, the compass turns accordingly.. i am trying to possibly get this to make it easier for me to compute the lat,lon that i am at. how do you do this btw? this is not trivial..

Share this post


Link to post
Share on other sites
Asuming your using 2 vertices for your camera, a from and a to point. Find the angle on your horizontal plane (XZ?) to a given point (0,1 XZ). Rotate your compass model the opposite angle.


Clear
LoadIdentity
Translate(compass position);
Rotate(0,1,0, - atan2(lookfat.x - lookfrom.x, lookat.z - lookfrom.z))
DrawCompass
SetCamera(lookfrom, lookat)
Draw rest of world


Looks good in words too me.

Share this post


Link to post
Share on other sites

  • 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!