Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Maths algorithm about Angular values... need help .

Author
Message
Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 17th Nov 2004 01:28
Does someone know if I have 2 points A and B, How I can retrieve the angle between default angle and these 2 points ?
( In fact, replacing A with A( 0,0,0 ) and B(xB,yB,zB) )
Finding angles.

Thanks.

Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 17th Nov 2004 01:29
Read this thread.
http://forum.thegamecreators.com/?m=forum_view&t=42750&b=1

1800+ XP - GeforceFX 5600 - 256MbDDR - 60Gb Hdd - XP Pro
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 17th Nov 2004 08:41 Edited at: 17th Nov 2004 08:43
If you want an angle a line makes with line 0 (line 0 being straight along the positive z axis) in 3d space, it's probably better to consider 2 angles - the first angle being the horizontal angle, from 0 to 360 degrees in the horizontal plane, and the second being the vertical angle - the angle the line makes with the horizontal plane.

This is a bit like the system used for describing the location of stars - (ie. right acsention and declination - like the horizontal and the vertical angles).

The reason it's better to have two angles is because there are an infinite number of lines in 3d space that would all share the same single angle from line 0. (They would form a cone shape around line 0)

So, if the 3d line is the line joining two objects a and b, then -

Horizontal angle (0 to 360 degrees):



Vertical angle (+90 is straight up, 0 is horizontal and -90 is straight down):



A little demo to see it working:





Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 17th Nov 2004 20:35
Thanks for your helps

I've founded a solution that does not use MATHS ( nor cos/sin too ) to replace weapon on the good place in front of player view ( in x4e project )

Login to post a reply

Server time is: 2025-05-28 03:11:32
Your offset time is: 2025-05-28 03:11:32