View Full Version : Compass Example
Dameria
05-19-2010, 01:45 PM
This is an example of a compass that I created using a rather complex concept of math called Trigonometry. There is also a mouse looking method to let you look around, use arrow keys if you want also. I left the boxes showing so that you can see a little bit how I did this. The box that you first see is North, if you look to the right you will see East, South, and then West, and then North again when you make a 360 turn.
I will release the text compass soon, I am going to start working on it now.
Dameria
05-19-2010, 05:10 PM
I just created the other compass that another person wanted me to make, it is merely a checker to see which direction you are facing and changes a 3d text to display whether you are facing N, NE, E, SE, S, SW, W, NW depending on which direction you are looking in. This was much easier because I didn't have to use the Law of Cosines (the trigonometry part) that I had to on the other compass and I did not have to worry about the rotation of the needles spinning the right way. They are both very useful however, so here is the "digital" compass ;)
shaydon
05-19-2010, 05:52 PM
I just created the other compass that another person wanted me to make, it is merely a checker to see which direction you are facing and changes a 3d text to display whether you are facing N, NE, E, SE, S, SW, W, NW depending on which direction you are looking in. This was much easier because I didn't have to use the Law of Cosines (the trigonometry part) that I had to on the other compass and I did not have to worry about the rotation of the needles spinning the right way. They are both very useful however, so here is the "digital" compass ;)
this is awesome!!!!
can i use this??? :D
Dameria
05-19-2010, 07:30 PM
this is awesome!!!!
can i use this??? :D
I allow everyone to use the programs that I create. Most of my programs are just examples of how to do little things in a program to make their own programs better. Good luck finding out how I did every small part of this compass (there is a lot of stuff that only I as the creator know, like that I moved each direction exactly 10 meters away from the base, so in the Law of Cosines function it divides by 200. If you use any other number but the 10 away from base and 200, it will not work correctly, however there is an easy way to fix it so it can be any number), stuff like that.
boppy
05-19-2010, 08:51 PM
This is awesome, but am I correct in assuming that this would work with a flight sim? I ask because the plane will be gaining altitude, rolling, spinning, etc.. Will the compass still be accurate?
Dameria
05-20-2010, 07:15 AM
This is awesome, but am I correct in assuming that this would work with a flight sim? I ask because the plane will be gaining altitude, rolling, spinning, etc.. Will the compass still be accurate?
If you want I can see your program and determine how to do it, but I should still be able to find a way to get it to work the same as this compas works, just do the same thing with the base and all the directions and move to airplane, just like what it says in the method for changing the compass.
Dameria
05-24-2010, 04:44 PM
Oh my god, I feel so foolish :o It seems that I had the compass working backwards the whole time. It took until now (seeing Artyfishl's compass) to notice this, so here it is, I fixed it and now you can redownload it to get the fixed version (all I needed to do was change the turn "right" into turn "left").
For some reason it never occurred to me while making it that a compass's needle is supposed to point north the entire time :confused: I feel stupid... Thanks Artyfishl for uploading your version, and I will get that Objectives example working soon (maybe this weekend or earlier).
The new compass is up on top or you can download it on this post (they are both the same world)
arty-fishL
05-25-2010, 10:23 AM
thanks, is my one similar to your one or are they completely different?
Dameria
05-25-2010, 02:24 PM
thanks, is my one similar to your one or are they completely different?
They are pretty different, but I noticed that on yours, the compass can get stuck on the north part for a split second, and if you fool around with it and turn it long enough you can make the needle face a little bit off of what it is supposed to.
arty-fishL
05-25-2010, 04:09 PM
They are pretty different, but I noticed that on yours, the compass can get stuck on the north part for a split second, and if you fool around with it and turn it long enough you can make the needle face a little bit off of what it is supposed to.
fixed in the new version, it was getting stuck cos the distances were too small and it was returning NaN when trying to invert, so I've moved the points five hundred and something more metres away from the camera, so any problem like that is barely noticeable and it now reloads the position from the reset point every 200 calculations, so it shouldn't go off slightly.