In case of duplicate - i already readed other posts from stackoverflow. Most of them are asociated with Unity3D, and a lot of them are using keywords like theta/omega .. ect. I can't understand any of that stuff. Also, i have 0 knowledge of those formula symbols so i understand 0% of what i readed.
I experiment making a bot for a video game, the only thing im stuck with is how to get the needed rotation degree till i face the given cordinate. Here i made quick example of my question in programming.
Things that i know in the situation:
- Player1 position
- Player1 rotation
- Player2 position (i need to face this player)
2D map of the situation. Click here
And here is how it looks in c#
using System;
public class Program
{
// Player 1 cordinates
public static float p1x = 2;
public static float p1y = 3;
public static float p1rotation = 0; // In degrees 0-360
// Player 2 cordinates
public static float p2x = 6;
public static float p2y = 4;
// Player 1 needed degree to face Player 2
public static float needed_distance;
public static void Main()
{
needed_distance = ??; // no clue how to get this value ...
Console.WriteLine("The needed distance is: "+needed_distance);
}
}
Please don't mark this as a duplicate, my math skills are even below zero. I can understand better if someone tries to answer me using the example that i made.