|
439 | 439 | ---@param t integer -- number of ticks to simulate
|
440 | 440 | ---@param d number? -- strafe deviation angle (optional)
|
441 | 441 | ---@param simulateCharge boolean? -- simulate shield charge starting now
|
| 442 | +---@param fixedAngles EulerAngles? -- if provided, use this view-angle for charge direction |
442 | 443 | ---@return { pos : Vector3[], vel: Vector3[], onGround: boolean[] }?
|
443 |
| -local function PredictPlayer(player, t, d, simulateCharge) |
| 444 | +local function PredictPlayer(player, t, d, simulateCharge, fixedAngles) |
444 | 445 | if not gravity or not stepSize then return nil end
|
445 | 446 | local vUp = Vector3(0, 0, 1)
|
446 | 447 | local vStep = Vector3(0, 0, stepSize)
|
@@ -487,7 +488,8 @@ local function PredictPlayer(player, t, d, simulateCharge)
|
487 | 488 | -- =========================================================================
|
488 | 489 | if simulateCharge then
|
489 | 490 | -- 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() |
491 | 493 | forward.z = 0 -- ignore vertical component
|
492 | 494 | forward = Normalize(forward)
|
493 | 495 |
|
@@ -1290,7 +1292,13 @@ local function OnCreateMove(pCmd)
|
1290 | 1292 | -- If charge-reach exploit is READY (full meter, demo, exploit enabled) but we're **not yet charging**,
|
1291 | 1293 | -- run a secondary prediction that simulates starting a charge right now.
|
1292 | 1294 | 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) |
1294 | 1302 | if not predData then return end
|
1295 | 1303 |
|
1296 | 1304 | pLocalPath = predData.pos
|
@@ -1339,7 +1347,7 @@ local function OnCreateMove(pCmd)
|
1339 | 1347 | -- Default to Menu.Aimbot.SwingTime since we're not using instant attack
|
1340 | 1348 | local simTicks = Menu.Aimbot.SwingTime
|
1341 | 1349 |
|
1342 |
| - local predData = PredictPlayer(player, simTicks, strafeAngle) |
| 1350 | + local predData = PredictPlayer(player, simTicks, strafeAngle, false, nil) |
1343 | 1351 | if not predData then return end
|
1344 | 1352 |
|
1345 | 1353 | vPlayerPath = predData.pos
|
|
0 commit comments