Solved Radar Rotation

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Solaire

Respected Hacker
Dank Tier VIP
Dec 15, 2013
1,051
16,353
62
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[2];
DrawPoints(*MyPlayer.Yaw, CalcAngle(*MyPlayer.Position, *PlayerList[i].Position, *MyPlayer.Yaw), Get2dDistance(*MyPlayer.Position, *PlayerList[i].Position), Draws);

DoMathX = Draws[0];
DoMathY = (sqrt((-(Draws[0] * Draws[0])) + (Draws[1] * Draws[1])));

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

	DrawXY[1] = Distance;
}
Calculate Angle function
C++:
float CalcAngle(float src[2], float dst[2], float angles)
{
	float deltaX = (src[0]) - (dst[0]);
	float deltaY = (src[1]) - (dst[1]);

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

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

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

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

	if (angles < 0)
		angles += 360;

	return angles;
}
Get2dDistance Function
C++:
float Get2dDistance(float Me[2], float You[2])
{
	return sqrt(((You[0] - Me[0]) * (You[0] - Me[0])) + ((You[1] - Me[1]) * (You[1] - Me[1])));
}
 

Solaire

Respected Hacker
Dank Tier VIP
Dec 15, 2013
1,051
16,353
62
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 :D)

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

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
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 :D)

EDIT: My radar rotates now :D
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:

Read the How to Ask Questions Guide
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
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods