Gamestudio Links
Zorro Links
Newest Posts
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
Zorro version 3.0 prerelease!
by TipmyPip. 02/24/26 17:09
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (Martin_HH, TipmyPip, AndrewAMD, Grant), 5,825 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Angle between 2 entities [Re: vlau] #137722
06/23/07 15:16
06/23/07 15:16
Joined: Jun 2005
Posts: 656
G
Grafton Offline
User
Grafton  Offline
User
G

Joined: Jun 2005
Posts: 656
I think you got it, it works fine. However the angle returned is always
relative to the world (absolute), but maybe this is what you want? You could
get relative offset angle in 0-360 from the "my" easily just by now subtracting
the my.pan, but I am sure you know this.

Code:
 
vec_diff(temp, you.x, my.x);
vec_to_angle(angle, temp);
angle = (angle - my.pan)%360;




Not two, not one.
Re: Angle between 2 entities [Re: Grafton] #137723
06/23/07 15:45
06/23/07 15:45
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline OP
Serious User
vlau  Offline OP
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Josiah, you're absoultely right! but I haven't notice that. Actually,
In my flightsim game, I want to figure out what is the bearing and heading
of the enemy plane relative to the player. With my previous code, if the
enemy is infront of the player (0 degree), then I turn it 180 away from
the enemy and it still read 0 degree not 180. Yeah, this is what I'm
really looking for, thank you very much!

Re: Angle between 2 entities [Re: vlau] #137724
06/23/07 16:08
06/23/07 16:08
Joined: Jun 2005
Posts: 656
G
Grafton Offline
User
Grafton  Offline
User
G

Joined: Jun 2005
Posts: 656
Glad to see you are still working on the flight sim, Last I remember it was
looking really good. Hope you can get a demo out sometime.


Not two, not one.
Re: Angle between 2 entities [Re: Grafton] #137725
06/23/07 16:31
06/23/07 16:31
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline OP
Serious User
vlau  Offline OP
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Well, I think you mean the F16, it just my first try, not seriously.
Recently, I'm gonna make a playable one, currently writing enemy and
wingman AI. I don't know when will it finish, cos I'm just do it in my
spare time.

Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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