Sorry guys I cant figure this out, dunno what exactly im doing wrong.
I always get values that only change with X Y coords. Eg. If y press space and x to go up and down with the mount it should change the pitch angle (pitch to the waypoint) but actually it remains the same. Any ideas of what could I be doing wrong???
here is a copy of my method assuming 'w' stands for waypoint.
Code:
public float pitchAngle(float playerX, float playerY, float playerZ, float wx, float wy, float wz)
{
float NextWayPointDistanceZ = wz - playerZ;
float NextWayPointDistanceX = wx - playerX;
float NextWayPointDistanceY=wy-playerY;
float NextWayPointDistance2D = (float)(Math.Sqrt(Math.Pow(NextWayPointDistanceX, 2)+Math.Pow(NextWayPointDistanceY, 2)));
float va = (float)(Math.Atan(NextWayPointDistanceZ / NextWayPointDistance2D));
return va;
}
since va doesnt change if a change Z value I assume the problem is here.