public static bool CanKnife() { foreach (var player in EntityList.List) { if (player.Dormant) { continue; } if (player.Health <= 0) { continue; } if (player.isTeam && !TriggerbotSettings.TargetTeam) { continue; } if (80 < MathFuncs.VectorDistance(Local.Position, player.Position)) { continue; } var newAimAngle = MathFuncs.CalcAngle(Local.EyeLevel, player.BonePosition(4)); var Fov = MathFuncs.CalcFov(Local.ViewAngle, newAimAngle); if (Fov > 70) { Fov = MathFuncs.CalcFov(Local.ViewAngle.NormalizeAngle(), newAimAngle.NormalizeAngle()); } if (Fov > 70) { continue; } return(true); } return(false); }
public static Vector2 CalculateAimAngle(Vector3 src, Entity target, bool withSmooth = true) { int bone = 0; switch (AimbotSettings.AimbotTarget) { case Settings.AimTarget.Head: bone = 8; break; case Settings.AimTarget.Neck: bone = 7; break; case Settings.AimTarget.UpperChest: bone = 6; break; case Settings.AimTarget.MiddleChest: bone = 5; break; case Settings.AimTarget.LowerChest: bone = 4; break; } Vector3 targetBone = target.BonePosition(bone); targetBone += target.VectorVelocity * gvar.GlobalVarsBase.interval_per_tick; Vector3 rando = new Vector3() { x = Randomize(AimbotSettings.Randomized), y = Randomize(AimbotSettings.Randomized), z = Randomize(AimbotSettings.Randomized), }; targetBone += rando; Vector3 srcEye = src; srcEye += Local.VectorVelocity * gvar.GlobalVarsBase.interval_per_tick; Vector3 delta = (targetBone - srcEye); float magn = delta.Length(); Vector2 newAimAngle = new Vector2() { x = (float)Math.Atan2(delta.y, delta.x), y = (float)-Math.Atan2(delta.z, magn), }; newAimAngle *= (180f / 3.14f); //Radians to Degrees newAimAngle.x -= (float)(Local.PunchAngle.x * (AimbotSettings.RcsYaw * 2) / 100); newAimAngle.y -= (float)(Local.PunchAngle.y * (AimbotSettings.RcsPitch * 2) / 100); newAimAngle = newAimAngle.ClampAngle(); double fov = MathFuncs.CalcFov(Local.ViewAndPunch, newAimAngle); double fov2 = MathFuncs.CalcFov(Local.ViewAndPunch.NormalizeAngle(), newAimAngle.NormalizeAngle()); if (withSmooth) { if (fov < fov2) { if (AimbotSettings.SmoothYaw > 0) { newAimAngle.x = (newAimAngle - Local.ViewAngle).x / (float)AimbotSettings.SmoothYaw + Local.ViewAngle.x; } if (AimbotSettings.SmoothPitch > 0) { newAimAngle.y = (newAimAngle - Local.ViewAngle).y / (float)AimbotSettings.SmoothPitch + Local.ViewAngle.y; } } else { if (AimbotSettings.SmoothYaw > 0) { newAimAngle.x = (newAimAngle.NormalizeAngle() - Local.ViewAngle.NormalizeAngle()).x / (float)AimbotSettings.SmoothYaw + Local.ViewAngle.NormalizeAngle().x; } if (AimbotSettings.SmoothPitch > 0) { newAimAngle.y = (newAimAngle.NormalizeAngle() - Local.ViewAngle.NormalizeAngle()).y / (float)AimbotSettings.SmoothPitch + Local.ViewAngle.NormalizeAngle().y; } } } return(newAimAngle); }