SatanIsGood

WAW PC External CalcAngle

Sep 15th, 2020
672
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. vec3 Clamp(vec3 angle)
  2. {
  3. if (angle.x > 89.0f && angle.x <= 180.0f)
  4. angle.x = 89.0f;
  5. if (angle.x > 180.0f)
  6. angle.x = angle.x - 360.0f;
  7. if (angle.x < -89.0f)
  8. angle.x = -89.0f;
  9. if (angle.y > 180.0f)
  10. angle.y = angle.y - 360.0f;
  11. if (angle.y < -180.0f)
  12. angle.y = angle.y + 360.0f;
  13. return angle;
  14. }
  15. vec3 Norm(vec3 angle)
  16. {
  17. if (angle.x > 180)
  18. angle.x -= 360.0f;
  19. if (angle.x < 180)
  20. angle.x += 360.0f;
  21. if (angle.y > 180)
  22. angle.y -= 360.0f;
  23. if (angle.y < 180)
  24. angle.y += 360.0f;
  25. return angle;
  26. }
  27. void setViewAngle(vec3 newAngle, int aimSpeed)
  28. {
  29. Sleep(1);
  30. vec3 currentAngle = getMyVA();
  31. vec3 diff, angle;
  32. diff.x = newAngle.x - currentAngle.x;
  33. diff.y = newAngle.y - currentAngle.y;
  34. diff.z = 0;
  35.  
  36. diff = clampAngles(normalizeAngle(diff));
  37. std::cout << "Delta X: " << diff.x << std::endl;
  38. std::cout << "Delta Y: " << diff.y << std::endl << std::endl;
  39.  
  40. angle.x = currentAngle.x;
  41. angle.y = currentAngle.y;
  42.  
  43. if (aimSpeed <= 0)
  44. aimSpeed = 1;
  45. angle.x += diff.x / getRandomNumber(aimSpeed, aimSpeed + 1);
  46. angle.y += diff.y / getRandomNumber(aimSpeed, aimSpeed + 1);
  47. angle.z = 0;
  48.  
  49. angle = normalizeAngle(angle);
  50. angle = clampAngles(angle);
  51.  
  52. *(vec3*)(variable.enginePointer + offset.vAngle) = angle;
  53. }
  54.  
  55. //Player.Pose/Stance patch
  56. //aimBotAngle.x = (float)(atanf(delta[2] / hyp) * 57.295779513082f);
  57.  
RAW Paste Data