Calculate angle with XYZ + rotation and my enemy his XYZ + rotation [Linear Algebra]
<p>Tally-ho chaps,</p>
<p>This question considers the art of linear algebra a place in math where I fall short to solve this. So I am hoping you guys could help me out :D.</p>
<p>I am trying to create a singleplayer autokicker cheat for a game called mount and blade. The goal of this autokicker is to always successfully kick the player using the power of math. I managed to achieve a lot of things thanks to the help of the internet (aimbot,esp,...) but now I am kinda stuck since I don't know enough linear algebra to get angles etc. These are the things I have</p>
<ul>
<li><p>My XYZ (player position)</p>
</li>
<li><p>Rotation starting from coordinate (0,0) radians converted to degrees (-180;180)</p>
</li>
<li><p>Enemy XYZ and rotation</p>
</li>
</ul>
<p>A player can successfully kick another player if the distance is less than
1 float and the player is in front of the other player. Hence why I need to calculate the angle between the direction I am looking and the enemy his XYZ. I will draw in paint what <a href="https://i.stack.imgur.com/KuYXp.png" rel="nofollow noreferrer">I want to achieve.</a></p>
<p><a href="https://i.stack.imgur.com/KuYXp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KuYXp.png" alt="enter image description here" /></a>
<a href="https://i.stack.imgur.com/0SVfW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0SVfW.png" alt="http://i.stack.imgur.com/0SVfW.png" /></a></p>
<p><a href="https://i.stack.imgur.com/0SVfW.png" rel="nofollow noreferrer">These are the values displayed in game</a> first is calculated distance next is enemy rotation and last is my rotation. I think rotation is done on the 0,0 spot</p>
<p>Any help is appreciated and awarded with a massive thumbs up :D!</p>
<pre><code>float Distance(D3DXVECTOR3 vector1, D3DXVECTOR3 vector2)
{
    return sqrt(pow((vector1.x - vector2.x), 2) + pow((vector1.y - vector2.y), 2) + pow((vector1.z - vector1.z), 2));
}
 
bool AutoKick()
{
    for (size_t i = 0; i &lt; cPlayerBase.size(); i++)
    {
        float DistanceToLocalPlayer = Distance(cPlayerBase[i]-&gt;vec, mainPlayer.vec); // vec is X Y Z
        float number = Rad2Deg(atan2(cPlayerBase[i]-&gt;vecRotation[1], cPlayerBase[i]-&gt;vecRotation[0])); // X Y rotation
       
        if(cPlayerBase[i]-&gt;address == mainPlayer.pointer ) 
        std::cout &lt;&lt; &quot;My degree -- &quot; &lt;&lt; number;
        if (DistanceToLocalPlayer != 0.0f)
        {
            std::cout &lt;&lt; &quot;Enemy Distance -- &quot; &lt;&lt; DistanceToLocalPlayer &lt;&lt; &quot;Enemy degree -- &quot; &lt;&lt; number;
        }
        std::cout &lt;&lt; std::endl;
    }
 
    return true;
}
</code></pre>