Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,238 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Creating an artificial horizon instrument #80211
07/02/06 08:30
07/02/06 08:30
Joined: Feb 2003
Posts: 211
Unna
F
Freddy_dup1 Offline OP
Member
Freddy_dup1  Offline OP
Member
F

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 Offline
Member
raymich  Offline
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
F
Freddy_dup1 Offline OP
Member
Freddy_dup1  Offline OP
Member
F

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,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
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
F
Freddy_dup1 Offline OP
Member
Freddy_dup1  Offline OP
Member
F

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 Offline
Senior Expert
ulillillia  Offline
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
F
Freddy_dup1 Offline OP
Member
Freddy_dup1  Offline OP
Member
F

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
F
Freddy_dup1 Offline OP
Member
Freddy_dup1  Offline OP
Member
F

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)


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1