This isn't a memory reading/editing question although because it is about my Bot, and apparently half of you are mathematical geniuses, I thought I would post it here.

I am creating a bot which will fly around and follow waypoints, looking for nodes to mine. I already have most of the things I need in regards to in-game values (I am doing this entirely out of process).

My knowledge of trigonometry is lacking at best. Using Shynd's wordpress blog as a basis I was able to develop a function for rotating on the XY to face another XY point. This is my function to do so (C#):

Due to the nature of my bot (operating on an XYZ plane as opposed to a XY plane) I need to adjust my pitch so I am at the right pitch to face my target (in this case a waypoint), as well as adjusting my rotation (which I will do using the function above). I am able to read my players current pitch, and the values of this Z pitch range from -1.553343 (the lowest pitch, pointing towards the ground the most) to 1.553343 (the highest pitch, point towards the sky the most).Code:public void TurnTo(PlayerObject LocalPlayer, double LocationX, double LocationY, int Accuracy, int Speed) { string turnDirection = ""; double currentRotation = RadiansToDegrees(LocalPlayer.Rotation); double l = 0, r = 0; // the angle to which we need to turn in order to face our location double f = Math.Atan2(LocationY - LocalPlayer.YPos, LocationX - LocalPlayer.XPos); if (f < 0) f = (Math.PI * 2) + f; f = RadiansToDegrees(f); // if our angle in degrees is greater than the direction we need to face if (currentRotation > f) { // we dont have to turn past north if we are turning right r = DifferenceBetween(currentRotation, f); // we do have to turn past north if we are turning left l = 360 - currentRotation + f; } // if our angle in degrees is less than the direction we need to face if (currentRotation < f) { // we do have to turn past north if we are turning right r = currentRotation + (360 - f); // we dont have to turn past north if we are turning left l = DifferenceBetween(currentRotation, f); } if (l < r) turnDirection = "left"; if (r < l) turnDirection = "right"; if (DifferenceBetween(RadiansToDegrees(LocalPlayer.Rotation), f) < Accuracy) return; // move our mouse to center of screen MC.MoveMouseToCenter(); Thread.Sleep(100); // press right mouse button down MC.RightMouseDown(); Thread.Sleep(100); double DegreesToGo; int oldX = CenterScreenX; if (turnDirection == "left") { // 'l' is how many degrees we have to turn while (DifferenceBetween(RadiansToDegrees(LocalPlayer.Rotation), f) > Accuracy) { DegreesToGo = DifferenceBetween(RadiansToDegrees(LocalPlayer.Rotation), f); MC.MoveMouse(oldX - Math.Sqrt(DegreesToGo / Speed), CenterScreenY); oldX = oldX - (int)Math.Round(Math.Sqrt(DegreesToGo / Speed)); Thread.Sleep(25); } } if (turnDirection == "right") { // 'r' is how many degrees we have to turn while (DifferenceBetween(RadiansToDegrees(LocalPlayer.Rotation), f) > Accuracy) { DegreesToGo = DifferenceBetween(RadiansToDegrees(LocalPlayer.Rotation), f); MC.MoveMouse(oldX + Math.Sqrt(DegreesToGo / Speed), CenterScreenY); oldX = oldX + (int)Math.Round(Math.Sqrt(DegreesToGo / Speed)); Thread.Sleep(25); } } MC.RightMouseUp(); }

What I am asking is, using my current XYZ and my targets XYZ (in this case my target is my next waypoint), how can I determine what my pitch needs to be in order to be facing this target on the Z-plane?Edit:Forgot to say, even if I could work out an angle between 180 and 0 (180 for looking straight down, and 0 for looking straight up, or vice versa) that would help greatly.

Thankyou for your time, I hope someone knows (Google doesnt!)

## Bookmarks