Skip to content

Commit e6cc3d3

Browse files
Add files via upload
1 parent 25fb281 commit e6cc3d3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

A_Swing_Prediction.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,9 @@ end
439439
---@param t integer -- number of ticks to simulate
440440
---@param d number? -- strafe deviation angle (optional)
441441
---@param simulateCharge boolean? -- simulate shield charge starting now
442+
---@param fixedAngles EulerAngles? -- if provided, use this view-angle for charge direction
442443
---@return { pos : Vector3[], vel: Vector3[], onGround: boolean[] }?
443-
local function PredictPlayer(player, t, d, simulateCharge)
444+
local function PredictPlayer(player, t, d, simulateCharge, fixedAngles)
444445
if not gravity or not stepSize then return nil end
445446
local vUp = Vector3(0, 0, 1)
446447
local vStep = Vector3(0, 0, stepSize)
@@ -487,7 +488,8 @@ local function PredictPlayer(player, t, d, simulateCharge)
487488
-- =========================================================================
488489
if simulateCharge then
489490
-- Forward direction based on current view angles (horizontal only)
490-
local forward = engine.GetViewAngles():Forward()
491+
local useAngles = fixedAngles or engine.GetViewAngles()
492+
local forward = useAngles:Forward()
491493
forward.z = 0 -- ignore vertical component
492494
forward = Normalize(forward)
493495

@@ -1290,7 +1292,13 @@ local function OnCreateMove(pCmd)
12901292
-- If charge-reach exploit is READY (full meter, demo, exploit enabled) but we're **not yet charging**,
12911293
-- run a secondary prediction that simulates starting a charge right now.
12921294
local simulateCharge = (not isCurrentlyCharging) and isExploitReady
1293-
local predData = PredictPlayer(player, simTicks, strafeAngle, simulateCharge)
1295+
local fixedAngles = nil
1296+
if simulateCharge and CurrentTarget then
1297+
-- Use current target's position to define intended charge heading for prediction
1298+
fixedAngles = Math.PositionAngles(pLocalOrigin, CurrentTarget:GetAbsOrigin())
1299+
end
1300+
1301+
local predData = PredictPlayer(player, simTicks, strafeAngle, simulateCharge, fixedAngles)
12941302
if not predData then return end
12951303

12961304
pLocalPath = predData.pos
@@ -1339,7 +1347,7 @@ local function OnCreateMove(pCmd)
13391347
-- Default to Menu.Aimbot.SwingTime since we're not using instant attack
13401348
local simTicks = Menu.Aimbot.SwingTime
13411349

1342-
local predData = PredictPlayer(player, simTicks, strafeAngle)
1350+
local predData = PredictPlayer(player, simTicks, strafeAngle, false, nil)
13431351
if not predData then return end
13441352

13451353
vPlayerPath = predData.pos

0 commit comments

Comments
 (0)