Solved How to find the angle an enemy is facing?

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

sti88

Newbie
Full Member
Sep 21, 2014
8
122
0
Hi everyone,

I've been working on an aim assist hack. Major of the component is working perfectly fine except for one problem. In CS:GO the character model's head aren't 100% dead center of the model box, but using the coordinate calculating the angle to aim will only lead me to cursor to the center of the model box. From observation the model's physical head is a little offsetted to the front of the model box. Depending on where the enemy is facing my aim can be off by a couple degree. I understand to fix this aim offset isn't hard. All I needed was to find out where the enemy is facing, but I've been having a hard time trying to locate a reliable AngRotation vector for the enemy to determine it's facing.

Does anyone have similar issue and how did you over come this problem?

Has anyone successfully located a reliable pointer to an enemy AngRotation vector from the client.dll or engine.dll?

Any tip and suggestion is appreciated.

Thank you!
 

BeesKnees

Coder
Full Member
Nobleman
Jul 24, 2013
124
1,973
3
I'm using the head bone for my aimbot and it's still not 100% accrurate in the middle of the head.
If you want to make it perfect, you have to adjust the head bone coordinate by using the rotation of the enemy model (as you first attempted to, if I read correct).
nope, just extend the head bone from the neck bone like this and it will be dead-center everytime.

C++:
void GetBonePosition(int player, int BoneNumber, float *FloatArray)
	{ 
		DWORD eBase;

		RPM (Client + eBaseAddy  + (player * eLoopDistance)),&eBase, sizeof(DWORD), 0);
		RPM (eBase + bMatrixOffs), &boneBase, sizeof(DWORD), 0);
		RPM (boneBase + BoneNumber * boneLoopDistance), &m_vecStoreboneData, sizeof(m_vecStoreboneData), NULL);
		FloatArray[0] = m_vecStoreboneData[0][3]; 
		FloatArray[1] = m_vecStoreboneData[1][3]; 
		FloatArray[2] = m_vecStoreboneData[2][3]-63 ;
		if(BoneNumber == 10) //head bone
		{
			RPM (boneBase + 5 * boneLoopDistance), &tempBoneData, sizeof(tempBoneData), NULL);
			FloatArray[0] = m_vecStoreboneData[0][3] + (m_vecStoreboneData[0][3] - tempBoneData[0][3])/2; 
			FloatArray[1] = m_vecStoreboneData[1][3] + (m_vecStoreboneData[1][3] - tempBoneData[1][3])/2; 
			FloatArray[2] = (m_vecStoreboneData[2][3]-63) + (m_vecStoreboneData[2][3] - tempBoneData[2][3])/2;
		
		}
	}
 

sti88

Newbie
Full Member
Sep 21, 2014
8
122
0
So after some more searching I was able to find a pointer from the base entity address that points to enemy AngRotation vector. Here's where I have another issue of actually using this information.

I use this simple logic to calculate the angle difference between my facing and enemy's facing. Zero means we are facing the same way and closest to +-180 means we are facing each other.

var rotation = enemy.AngRotationX - me.AngRotationX;
if (rotation > 180) rotation = rotation - 360;
if (rotation < -180) rotation = rotation + 360;

Knowing the angle difference, I try using a Sin function to calculate the offset. The reason I tried using this is because I know at angle 0 or 180 there isn't much offset, and the offset comes from when I'm looking at his left or right side (Angle of -90 or 90). Sadly, that didn't work. After more detail analyze of the model, I realize the offset is more complicated.

Next I tried manually setting the offset per combination of the angle. Similar to something like this.

if (rotation < -80 || rotation > 150) return 3;
if (rotation < 110 || rotation > -30) return -2;

Then I realize that the model have a lot more head offset base on the animation of the character or stance. Using the manual setting wasn't flexible enough to make it work.

I'm wondering if anyone have a bullet proof method of getting the aim to lock dead on the head at all angle of interception.

Thanks
 

squeenie

Hacker
Meme Tier VIP
Dank Tier Donator
Mar 6, 2013
677
5,478
37
I'm wondering if anyone have a bullet proof method of getting the aim to lock dead on the head at all angle of interception.

Thanks
Are you basically trying to make an aimbot?
 

BeesKnees

Coder
Full Member
Nobleman
Jul 24, 2013
124
1,973
3
nubtik makes a great GetBonePosition tut here on the forums. search HL2 triggerbot.
 

sti88

Newbie
Full Member
Sep 21, 2014
8
122
0
Are you basically trying to make an aimbot?
Yes, I'm making an Aimbot. I've made a functional one already. The problem I'm trying to overcome is to refine the aim a little more so it hits the specific body part more accurately instead of just aiming dead center at the model box.
 

sti88

Newbie
Full Member
Sep 21, 2014
8
122
0
nubtik makes a great GetBonePosition tut here on the forums. search HL2 triggerbot.
Oh, I never thought about bone position. I think that might be exactly what I needed to refine my aim. Thanks for the tip.
 

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
Oh, I never thought about bone position. I think that might be exactly what I needed to refine my aim. Thanks for the tip.
I'm using the head bone for my aimbot and it's still not 100% accrurate in the middle of the head.
If you want to make it perfect, you have to adjust the head bone coordinate by using the rotation of the enemy model (as you first attempted to, if I read correct).
 

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
nope, just extend the head bone from the neck bone like this and it will be dead-center everytime.

C++:
void GetBonePosition(int player, int BoneNumber, float *FloatArray)
	{ 
		DWORD eBase;

		RPM (Client + eBaseAddy  + (player * eLoopDistance)),&eBase, sizeof(DWORD), 0);
		RPM (eBase + bMatrixOffs), &boneBase, sizeof(DWORD), 0);
		RPM (boneBase + BoneNumber * boneLoopDistance), &m_vecStoreboneData, sizeof(m_vecStoreboneData), NULL);
		FloatArray[0] = m_vecStoreboneData[0][3]; 
		FloatArray[1] = m_vecStoreboneData[1][3]; 
		FloatArray[2] = m_vecStoreboneData[2][3]-63 ;
		if(BoneNumber == 10) //head bone
		{
			RPM (boneBase + 5 * boneLoopDistance), &tempBoneData, sizeof(tempBoneData), NULL);
			FloatArray[0] = m_vecStoreboneData[0][3] + (m_vecStoreboneData[0][3] - tempBoneData[0][3])/2; 
			FloatArray[1] = m_vecStoreboneData[1][3] + (m_vecStoreboneData[1][3] - tempBoneData[1][3])/2; 
			FloatArray[2] = (m_vecStoreboneData[2][3]-63) + (m_vecStoreboneData[2][3] - tempBoneData[2][3])/2;
		
		}
	}
Never thought of a way that simple, thank you! :)
 

sti88

Newbie
Full Member
Sep 21, 2014
8
122
0
nope, just extend the head bone from the neck bone like this and it will be dead-center everytime.

C++:
void GetBonePosition(int player, int BoneNumber, float *FloatArray)
	{ 
		DWORD eBase;

		RPM (Client + eBaseAddy  + (player * eLoopDistance)),&eBase, sizeof(DWORD), 0);
		RPM (eBase + bMatrixOffs), &boneBase, sizeof(DWORD), 0);
		RPM (boneBase + BoneNumber * boneLoopDistance), &m_vecStoreboneData, sizeof(m_vecStoreboneData), NULL);
		FloatArray[0] = m_vecStoreboneData[0][3]; 
		FloatArray[1] = m_vecStoreboneData[1][3]; 
		FloatArray[2] = m_vecStoreboneData[2][3]-63 ;
		if(BoneNumber == 10) //head bone
		{
			RPM (boneBase + 5 * boneLoopDistance), &tempBoneData, sizeof(tempBoneData), NULL);
			FloatArray[0] = m_vecStoreboneData[0][3] + (m_vecStoreboneData[0][3] - tempBoneData[0][3])/2; 
			FloatArray[1] = m_vecStoreboneData[1][3] + (m_vecStoreboneData[1][3] - tempBoneData[1][3])/2; 
			FloatArray[2] = (m_vecStoreboneData[2][3]-63) + (m_vecStoreboneData[2][3] - tempBoneData[2][3])/2;
		
		}
	}
Thanks BeesKnees! It works like a charm!

I found that the bone number from NubTIK are no longer valid.

To give back, here's the useful list of bones I found for current version of CS:GO.

Pelvis = 0,
Stomach = 1,
Core = 2,
Chest = 3,
ChestUpper = 4,
Neck = 5,
NeckUpper = 6,
LeftShoulder = 7,
LeftForearm = 8,
LeftHand = 9,
HeadMiddle = 10,
HeadUpper = 11,
HeadLower = 12,
RightShoulder = 13,
RightForearm = 14,
RightHand = 15,
WeaponTopTip = 16,
WeaponTopMid = 17,
None = 18,
None2 = 19,
WeaponBottomClip = 20,
WeaponBottomHandle = 21,
WeaponMid = 22,
RightHip = 23,
RightKnee = 24,
RightFoot = 25,
LeftHip = 26,
LeftKnee = 27,
LeftFoot = 28,
RightToe = 37,
LeftToe = 38

Cheers!
 

rN'

Jr.Hacker
Meme Tier VIP
Jan 19, 2014
340
5,268
41
Take a look into the SDK and you will see that the BoneMatrixArray which saves all bone data is a matrix3x4_t structure.
C++:
struct Vector
{
	float x, y, z;
};

bool GetBonePosition( DWORD dwEntity, int iBone, Vector vecBone )
{
	matrix3x4_t BoneMatrixArray;
	if( !ReadProcessMemory( hProcess, LPCVOID( dwEntity + OFFSETS_BONEMATRIX + 0x30 * iBone ), &BoneMatrixArray, sizeof( matrix3x4_t ), NULL ) )
		return false;

	vecBone.x = BoneMatrixArray.m_flMatVal[ 0 ][ 3 ];
	vecBone.y = BoneMatrixArray.m_flMatVal[ 1 ][ 3 ];
	vecBone.z = BoneMatrixArray.m_flMatVal[ 2 ][ 3 ];

	return true;
}
 
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