❓ RCS Snapping to one location

Posts 1–8 of 8 · Page 1 of 1
❓ RCS Snapping to one location
I am currently working on an external recoil control system and it keeps snapping to one location instead of wherever I am shooting. I have been debugging for the last couple hours and have had no luck so if anyone could help me, it would be appreciated.

Code:
struct RCS {
	void SetViewAngles(vect angle)
	{
		vect newAngle = angle;
		if (newAngle.x >= -180 && newAngle.x <= 180 && newAngle.y >= -180 && newAngle.y <= 180)
		{
			mem.WriteMemory<vect>(var.clientState + offsets.dwClientState_ViewAngles, newAngle);
		}

	}
	void Recoil() {
		vect CurrentViewAngles, vPunch, NewViewAngles, OldAimPunch;
		OldAimPunch.x = 0,  OldAimPunch.y = 0, OldAimPunch.z = 0;
		var.shotsFired = mem.ReadMemory<int>(var.localPlayer + offsets.m_iShotsFired);
		var.localPlayer = mem.ReadMemory<DWORD>(mod.Client.dwBase + offsets.dwLocalPlayer);
		var.clientState = mem.ReadMemory<DWORD>(mod.Engine.dwBase + offsets.dwClientState);
		if (var.RCS == true && var.shotsFired >= 1) {
			vPunch = mem.ReadMemory<vect>(var.localPlayer + offsets.m_aimPunchAngle);
			vPunch.x = vPunch.x * 2.f;
			vPunch.y = vPunch.y * 2.f;
			CurrentViewAngles = mem.ReadMemory<vect>(var.clientState + offsets.m_viewPunchAngle);
			NewViewAngles.x = ((CurrentViewAngles.x + OldAimPunch.x) - vPunch.x);
			NewViewAngles.y = ((CurrentViewAngles.y + OldAimPunch.y) - vPunch.y);
			NewViewAngles.z = 0;

			SetViewAngles(NewViewAngles);

			OldAimPunch.x = vPunch.x;
			OldAimPunch.y = vPunch.y;

			Sleep(1);
		}
		else {
			OldAimPunch.x = 0, OldAimPunch.y = 0, OldAimPunch.z = 0, NewViewAngles.x = 0, NewViewAngles.y = 0, NewViewAngles.z = 0;
		}
	}
} RCS;
Code:
CurrentViewAngles = mem.ReadMemory<vect>(var.clientState + offsets.m_viewPunchAngle);
Are you trying to read your view punch angle into your current view angles?
Quote Originally Posted by lenny69 View Post
Code:
CurrentViewAngles = mem.ReadMemory<vect>(var.clientState + offsets.m_viewPunchAngle);
Are you trying to read your view punch angle into your current view angles?
Whether I use punch angles, eyes Angle, or client State View Angles, it still seems to snap to the center of the screen instead of where I am shooting.
Quote Originally Posted by Sandwich View Post
Whether I use punch angles, eyes Angle, or client State View Angles, it still seems to snap to the center of the screen instead of where I am shooting.
Try using "cl_showpos 1" and see what your angles are. Also, print out all values to your console/cmd window and see what's going wrong. What I see with your code is that you're only working with the viewpunch angles and not the actual player viewangles.

I think it works something like this:
Vector3 oldpunch;

Vector3 viewAngles = rpm(player+dwClientState_ViewAngles)
Vector3 punchAngles = rpm(player+m_aimPunchAngle)
punchAngles *= Vector3(2f,2f,0)

Vector3 newViewAngles = Vector3(
viewAngles.x - (punchAngles.x - oldpunch.x),
viewAngles.y - (punchAngles.y - oldpunch.y),
0
)
Now it drags down to your feet despite angle parameters. Do I need to change the parameters for x and y?
Code:
if (newAngle.x >= -180 && newAngle.x <= 180 && newAngle.y >= -180 && newAngle.y <= 180)
		{
			mem.WriteMemory<vect>(var.clientState + offsets.dwClientState_ViewAngles, newAngle);
		}
Is there any chance you could post the full code you created? Also try going in-game and debugging your viewangles. You can also try flipping the X and Y values and see if that fixes it.
Solved, thanks lenny. Can someone close this please.
when it will come out
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us