2 registered members (OptimusPrime, AndrewAMD),
14,580
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Creating an artificial horizon instrument
#80211
07/02/06 08:30
07/02/06 08:30
|
Joined: Feb 2003
Posts: 211 Unna
Freddy_dup1
OP
Member
|
OP
Member
Joined: Feb 2003
Posts: 211
Unna
|
Hello,
I tried to make an artificial horizon for my flight simulator. It’s a view entity-ball. The upper part is blue (sky) and the lower part is green (earth). How can I make the view-enitity move like the horizon? (even when flying upside down and in every direction) I tried it but every time it works I discover, that it isn’t working at a special angle.
Last edited by Freddy; 07/02/06 21:52.
|
|
|
Re: Creating an artificial horizon
[Re: Freddy_dup1]
#80212
07/02/06 11:54
07/02/06 11:54
|
Joined: May 2005
Posts: 107 Latvia
raymich
Member
|
Member
Joined: May 2005
Posts: 107
Latvia
|
this is code that i am using for my skybox,, its generally a huge geosphere model that follows player all the time, making a nice sky effect,,, Code:
function follow_player() // Used for Skyglobe { while (1) { my.x = camera.x; my.y = camera.y; //my.z = camera.z +1; //If you have a space flight level or something, you can turn this on. WAIT (1); } }
Action Skyglobe {
my.hidden = on; my.passable = On; my.nofog = On; my.unlit = On; my.ambient = 100; follow_player(); //---------------------- sun_light = 10; // Amount of Light sun_angle.pan = 360; // Compass Direction the Light will come from sun_angle.tilt = 30; // Sunlights Hight //--------------------------- }
just apply it to your horizon model
Last edited by raymich; 07/02/06 11:54.
|
|
|
Re: Creating an artificial horizon
[Re: raymich]
#80213
07/02/06 21:50
07/02/06 21:50
|
Joined: Feb 2003
Posts: 211 Unna
Freddy_dup1
OP
Member
|
OP
Member
Joined: Feb 2003
Posts: 211
Unna
|
Thanks, but I meant the instrument that can be found in a aircroft cockpit. It's a ball that moves like the horizon. (ask google) (I changed the title of the post) Can someone help me? It's difficult because it's a view-entitiy. 
Last edited by Freddy; 07/02/06 21:53.
|
|
|
Re: Creating an artificial horizon
[Re: Freddy_dup1]
#80214
07/02/06 23:51
07/02/06 23:51
|
Joined: Aug 2003
Posts: 7,440 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,440
Red Dwarf
|
i think :
horizont.roll=-player.roll; horizont.tilt=-player.tilt;
putting it into a while loop should be fine, dont forget to replace "horizont" by your view entity name
"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
|
|
|
Re: Creating an artificial horizon
[Re: Michael_Schwarz]
#80215
07/03/06 02:00
07/03/06 02:00
|
Joined: Feb 2003
Posts: 211 Unna
Freddy_dup1
OP
Member
|
OP
Member
Joined: Feb 2003
Posts: 211
Unna
|
Thanks, but that works only at some angles. Sometimes when I fly up it shows the green side and sometimes the blue - depending on the angles of the plane. Maybe I need something like: ang_add, ang_rotate... 
|
|
|
Re: Creating an artificial horizon
[Re: Freddy_dup1]
#80216
07/03/06 02:56
07/03/06 02:56
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
Try using a view entity in the shape of a sphere. From there, set the tilt and roll. The artificial horizon indicator doesn't use pan (that's the function of the compass), but it uses tilt (up and down) and roll (as from banking).
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: Creating an artificial horizon
[Re: ulillillia]
#80217
07/03/06 05:26
07/03/06 05:26
|
Joined: Feb 2003
Posts: 211 Unna
Freddy_dup1
OP
Member
|
OP
Member
Joined: Feb 2003
Posts: 211
Unna
|
This is a bit better, but it still isn't working at all angles: Code:
if(ang(player.roll)<-90)||(ang(player.roll)>90){horizon_ent.tilt=-player.tilt;}else{horizon_ent.tilt=player.tilt;} horizon_ent.roll=-player.roll; I will continue to work on it...
Last edited by Freddy; 07/03/06 07:07.
|
|
|
Re: Creating an artificial horizon
[Re: Freddy_dup1]
#80218
07/05/06 09:43
07/05/06 09:43
|
Joined: Feb 2003
Posts: 211 Unna
Freddy_dup1
OP
Member
|
OP
Member
Joined: Feb 2003
Posts: 211
Unna
|
I found a way to make an artificial horizon:  Create a second view, that circles around a ball. The faces of the ball face inwards. Code:
temp.X = -35; temp.Y = 0; temp.Z = 0; VEC_ROTATE(temp.X,player.PAN); VEC_ADD(temp.X,pos_1.X); vec_set(camera2.x,temp.x); pos_2 is the center of the ball. (The ball is deep under the terrain)
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|