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.

Dark GDK / Angle between two 3D points?

Author
Message
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 8th Jan 2010 15:53
This is more like a question of theory.
Maybe there is no such thing as an angle between two points, but let's say I have two points in space, I could draw a line between them. What XYZ angles would that have?
I'm not very good at maths but I'm familiar with vectors and such...

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 8th Jan 2010 16:50
direction = point1 - point2
angle.x = atan2( direction.y, length( direction.xz ) )
angle.y = atan2( direction.x, direction.z )

_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 9th Jan 2010 13:59 Edited at: 9th Jan 2010 14:10
Wow - now that's a valuable reply!
Thanks!

Just a little question: What's direction.xz ?
I'm using D3DXVECTOR3 and there is no .xz in this class!

EDIT:

Do you mean the xz-plane with that?
So should I just set the y component of this vector to 0?

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 9th Jan 2010 16:28
That was just pseudo code to represent a 2D vector constructed from the X and Z components of the 3D one, but you can always just set the Y to 0.0(but doing so will cause night goblins of the bad-code squad to slay you while you sleep).

Freddix
AGK Developer
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 23rd Jan 2010 16:53
Thank you for the informations.
There is just something to do to keep the correct camera rotation because when we reach top/bottom position the camera seem to rotate on a angle to keep top view.

Login to post a reply

Server time is: 2024-11-20 05:36:02
Your offset time is: 2024-11-20 05:36:02