#### Solaire

##### Respected Hacker
Dank Tier VIP
I'm currently trying to get my radar to rotate, and I'm have a lot of trouble with that. Only the top part will rotate, and even then it's way off (Hits 180 degrees from north before I do). I've seen a lot of sources and can't really make sense of the math. A quick explanation, or mentioning any sort of maths I should learn for this would be really useful.

Current calculations:
C++:
``````float Draws;
DrawPoints(*MyPlayer.Yaw, CalcAngle(*MyPlayer.Position, *PlayerList[i].Position, *MyPlayer.Yaw), Get2dDistance(*MyPlayer.Position, *PlayerList[i].Position), Draws);

DoMathX = Draws;
DoMathY = (sqrt((-(Draws * Draws)) + (Draws * Draws)));

DrawY = Center - DoMathY;
DrawX = Center - DoMathX;``````
DrawPoints function
C++:
``````void DrawPoints(float YourYaw, float CalcYaw, float Distance, float * DrawXY)
{
DrawXY = CalcYaw - YourYaw;

DrawXY = Distance;
}``````
Calculate Angle function
C++:
``````float CalcAngle(float src, float dst, float angles)
{
float deltaX = (src) - (dst);
float deltaY = (src) - (dst);

if ((dst) > (src) && (dst) <= (src))
{
angles = atanf(deltaX / deltaY) * -180.0f / pi;
}

else if ((dst) >= (src) && (dst) > (src))
{
angles = atanf(deltaX / deltaY) * -180.0f / pi + 180.0f;
}

else if ((dst) < (src) && (dst) >= (src))
{
angles = atanf(deltaX / deltaY) * -180.0f / pi - 180.0f;
}

else if ((dst) <= (src) && (dst) < (src))
{
angles = atanf(deltaX / deltaY) * -180.0f / pi + 360.0f;
}

if (angles < 0)
angles += 360;

return angles;
}``````
Get2dDistance Function
C++:
``````float Get2dDistance(float Me, float You)
{
return sqrt(((You - Me) * (You - Me)) + ((You - Me) * (You - Me)));
}``````

• #### Solaire

##### Respected Hacker
Dank Tier VIP
Can't believe I missed that! I'm currently figuring out the math right now, thanks (Btw, I found your code to be very clean and straightforward. Nice job )

EDIT: My radar rotates now Thank you very much, GAFO!

Last edited:

#### GAFO666

##### Hacker
Meme Tier VIP
Can't believe I missed that! I'm currently figuring out the math right now, thanks (Btw, I found your code to be very clean and straightforward. Nice job )

EDIT: My radar rotates now Thank you very much, GAFO!
yeh no problem, I was talking to my Math Teacher on University about that to figure it out tho xD

Attention! Before you post:

99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

• Fill out the form correctly
• Tell us the game name & coding language 