Bingdom
Googledom
I'm trying to make a small game that would show me 3d gravitational fields from planets and them pulling each other.
I've been having a hard time trying to figure out on getting the altitude and azimuth (pan, tilt) from one planet to another in a 3d world, which I would use to get the direction for accelerating the planet.
This is what I have found so far.
Azimuth seems to always return -180 and altitude seem to return 0.
(This is inside a 'with' statement)
Can someone please help me out?
I've been having a hard time trying to figure out on getting the altitude and azimuth (pan, tilt) from one planet to another in a 3d world, which I would use to get the direction for accelerating the planet.
This is what I have found so far.
Code:
xx = other.x - x;
yy = other.y - y;
zz = other.z - z;
alt = radtodeg(arctan2(yy, sqrt(xx*xx + zz*zz)));
az = radtodeg(arctan2(-xx, -z));
(This is inside a 'with' statement)
Can someone please help me out?