Real bearing

Non-platform specific questions.

Real bearing

Postby FERdeBOER » Sun Mar 27, 2011 3:50 pm

Hi to all,

I would like to put a real bearing indicator for the game I'm creating, but I find that GE has a 360º diverse from the "real", where 0 is North, 270 West, 180 South, 90, East.
So I've created a text actor and, in draw actor put:
Code: Select all
bearing.textNumber = round(player.angle);

But the angles it shows is the GE ones: East 0º, North 90º...

How can I fix this?

Thank you.
FERdeBOER
 
Posts: 36
Joined: Fri Mar 12, 2010 8:03 pm
Location: Good question...
Score: 0 Give a positive score

Re: Real bearing

Postby schnellboot » Sun Mar 27, 2011 5:03 pm

Code: Select all
switch (player.angle)
{
case 0: bearing.textNumber=90;
break;
case 90: bearing.textNumber=0;
break;
case 180: bearing.textNumber=270;
break;
case 270: bearing.textNumber=180;
break;
}


I dunno if this is what you want ..
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Real bearing

Postby FERdeBOER » Sun Mar 27, 2011 5:42 pm

Thank you for your answer.

I don't know what and where to put your code, but seems to be for "exact" situations for 90º show 0º... but I want to change it in all directions so, when the player is facing 190º (GE degrees) it shows 260º (true bearing).
FERdeBOER
 
Posts: 36
Joined: Fri Mar 12, 2010 8:03 pm
Location: Good question...
Score: 0 Give a positive score

Re: Real bearing

Postby schnellboot » Sun Mar 27, 2011 7:07 pm

Okay so for all angles use this:
Code: Select all
if(player.angle<=90)
{
    bearing.textNumber=player.angle+90-player.angle*2;
}
else if(player.angle<=180)
{
    bearing.textNumber=player.angle+270-(player.angle-90)*2;
}
else if(player.angle<=270)
{
    bearing.textNumber=player.angle+90-(player.angle-180)*2;
}
else if(player.angle<=360)
{
    bearing.textNumber=player.angle-90-(player.angle-270)*2;
}


ok put this in draw actor instead of
Code: Select all
bearing.textNumber = round(player.angle);


maybe there is an easier way, but this is my way.
I tried many times to fix this code so it should be perfect now.
If you find bugs, report them to me.
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Real bearing

Postby FERdeBOER » Sun Mar 27, 2011 8:51 pm

Thank you very much!

That's what I looked for. :mrgreen:
FERdeBOER
 
Posts: 36
Joined: Fri Mar 12, 2010 8:03 pm
Location: Good question...
Score: 0 Give a positive score

Re: Real bearing

Postby schnellboot » Sun Mar 27, 2011 8:54 pm

you're welcome
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest