Not even looking at your code. Please separate that cancer normalization statement into normalization and clamping functions.
"My" RCS Code
and before you ask, yes my offsets are up to date.Code:void NormalizeAngles(Vector &vecAngle) { if (!std::isfinite(vecAngle.x)) vecAngle.x = 0.0f; if (!std::isfinite(vecAngle.y)) vecAngle.y = 0.0f; while (vecAngle.y < -180.0f) vecAngle.y += 360.0f; while (vecAngle.y > 180.0f) vecAngle.y -= 360.0f; if (vecAngle.x > 89.0f) vecAngle.x = 89.0f; if (vecAngle.x < -89.0f) vecAngle.x = -89.0f; vecAngle.z = 0.0f; } void RCS() { DrawString("RCS running", menux + 250, menuy, MenuR, MenuG, MenuB, pFontSmall); if (RCSEnabled) { DrawString("RCS enabled", menux + 250, menuy + 20, MenuR, MenuG, MenuB, pFontSmall); static Vector vecOldPunchAngle = Vector(0, 0, 0); Vector vecPunchAngles = Nsane.Read<Vector>(LocalBase + Punch); Vector vecViewAngles = Nsane.Read<Vector>(dwClientState + ViewAngle); if (GetAsyncKeyState(VK_LBUTTON) & 0x8000) { DrawString("RCS button pressed", menux + 250, menuy + 40, MenuR, MenuG, MenuB, pFontSmall); Vector vecCurrent = { vecPunchAngles.x - vecOldPunchAngle.x, vecPunchAngles.y - vecOldPunchAngle.y, 0 }; vecViewAngles.x = vecViewAngles.x - (vecCurrent.x * 2); vecViewAngles.y = vecViewAngles.y - (vecCurrent.y * 2); //NormalizeAngles(vecViewAngles); Nsane.Write<Vector>(dwClientState + ViewAngle, vecViewAngles); //Nsane.Write<Vector>(dwClientState + ViewAngle, (0, 0, 0)); // Works } vecOldPunchAngle = vecPunchAngles; } }
so im having a problem, i have strings saying that everything is running but the angles are not being written. any help?
Epik helped me write this and he said it should 100% work
Not even looking at your code. Please separate that cancer normalization statement into normalization and clamping functions.
ok that makes sense, since i basically had Epik write this for me what should be in clamp just this?
Code:while (vecAngle.y < -180.0f) vecAngle.y += 360.0f; while (vecAngle.y > 180.0f) vecAngle.y -= 360.0f; if (vecAngle.x > 89.0f) vecAngle.x = 89.0f; if (vecAngle.x < -89.0f) vecAngle.x = -89.0f;
Code:inline float NormalizeAngle(float flAng) { if(!std::isfinite(flAng)) { return 0.0f; } return std::remainder(flAng, 360.0f); }Code:inline void ClampViewAngles(Vector3_t& vecAng) { vecAng.x = std::max(-89.0f, std::min(89.0f, NormalizeAngle(vecAng.x))); vecAng.y = NormalizeAngle(vecAng.y); vecAng.z = 0.0f; }
Last edited by Hunter; 06-07-2016 at 11:20 AM.
You should normalize your vector whenever you did any operation with them. This will prevent you from quadrant errors. Clamping has to be done once before writing the angles. If you're calling the normalize function whenever you're doing any operation with your vector, you're clamping your angles before you want them to be clamped, resulting in values that might be cut off before you finished doing operations with them.
That's still normalization + clamp.
shouldn't it be in a loop :S
also i'd use if shotsfired >= 1 instead
If that did work, then set
Outside the loop.Code:Vector vecOldPunchAngle;
If nothing still works, add me on skype. (signature)
-------
This is also something to consider,
Will set the recoil for only automatic weapons and not on awp,scout,pistol... if you don't set up a weapon check.Code:If (Shotfired > 1)
Last edited by ImStyL; 06-07-2016 at 10:24 AM.
1 week has passed and no further replies have been made by the OP. Assuming solved.
/Closed.