Maths Question.

Blitz3D Forums/Blitz3D Beginners Area/Maths Question.

Maximus Primal(Posted 2005) [#1]
Sorry I have not done any maths like this in at least 16 years so I am totaly lost on this.

Given two points at different heights. How do you calculate the angle between them. So you could (for example) know what angle to rasie your camera to look at the higher point.

Thanks

Max


Stevie G(Posted 2005) [#2]
Assuming the two points are entities in a 3d world then use deltapitch( ent1, ent2 ) .. this will return the pitch angle required for ent1 to point at ent2.


big10p(Posted 2005) [#3]
*Pythagoras turns in his grave* :)


jfk EO-11110(Posted 2005) [#4]
if it's 2D you can use Atan2:

angle=Atan2(x1-x2,y1-y2)


big10p(Posted 2005) [#5]
The param order is y,x for atan2. i.e. ATan2(y#,x#)


Maximus Primal(Posted 2005) [#6]
Thanks guys. Sorry for my poor maths in this area :(

Max


jfk EO-11110(Posted 2005) [#7]
big - that's what I always re-discover by trial and error :P


big10p(Posted 2005) [#8]
Me too, to be honest! :P