runewake2
Member

 Post: #1 Advice I am in need of some help. I am developing a 6DOF (Degree's of Freedom) game, similar to Descent and other space based FPS. I want to add a simple compass with six lines that will always point North, South, East, West, Up and Down no matter what angle your ship is at. I am planning on placing this around the targeting reticle and having lines fade out if one or both points of the line occupy the inside of the center reticle. While this would be fairly easy to do in a simple 2D game. I don't know how I could add the depth of lines I need for 3D. My original plan was to use basic lines and draw them with simple Trig functions. My only problem was that I couldn't get the math to work right. My second plan was to use something like six Lasers oriented in the direction I wanted and placed at the spot of the reticle. The only problem with this is that it would add more strain on the GPU then I want to and would prove distracting. My reticle is a simple Circle in the center of the screen with a horizontal line on either side ending in another circle. This compass was going to be placed over the center reticle. If anyone has any suggestions then please let me know. Until then, I'm going to keep working on my trig problems. Thanks for your help/advice.
03-19-2011 04:38 AM
Dandruff
Member

 Post: #2 RE: Advice You want the compass to act like a compass right? I had something similar to this. I was making a view mode were i wanted the player to turn to the acute angle of the camera and this is what i came up with: Code: ```//This is called when a movement key is pressed ScreenToPosDir(Vec2(0,0), tpos, screendir) angle.set(tpcamera(screendir.xz(),angle.x),angle.y); //The turning function Flt tpcamera(Vec2 &screen, Flt chrangle) {     Flt chrangletemp        =AngleFull(chrangle);     Flt screenangletemp    =AngleFull(Angle(screen)-PI_2);                 Flt offset=0.0;     if(screenangletemp>=PI)     {         if(chrangletemp-0.04>screenangletemp||chrangletemp<(screenangletemp-PI))             offset=-0.03;         if(chrangletemp>(screenangletemp-PI)&&chrangletemp(screenangletemp+PI))             offset=0.03;         if(chrangletemp<(screenangletemp+PI)&&chrangletemp>screenangletemp)             offset=-0.03;     }     return chrangle+offset; }``` chrangletemp is offset by 0.04 to prevent jitters. Replace screenangletemp with 0/2pi (i think that should be "north"..) and draw the line pointing to north based on the return value of the function. You can then calculate the other lines (south,east,west) based on that value (+/- 90 degrees). For the up and down thing maybe this will work. I was thinking to make the character look up/down based on the y direction of the screen like this : angle.set(tpcamera(screendir.xz(),angle.x),tpcamera(angle.y,screendir.y()); so maybe you can use the return value of tpcamera(angle.y,screendir.y()) for your compass too (replace screendir.y() with something else). Well, times up; gotta sleep. This is an interesting problem and i'll be here tomorrow hope i helped (This post was last modified: 03-19-2011 08:15 AM by Dandruff.)
03-19-2011 08:13 AM
runewake2
Member

 Post: #3 RE: Advice Thanks, I'll play with it this weekend and see what I come up with. Also, 1/2pi is north. 0/2pi is East. (This post was last modified: 03-19-2011 05:36 PM by runewake2.)
03-19-2011 05:26 PM
 « Next Oldest | Next Newest »