lgbot: compensate ground friction so the bot moves at the set speed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
esefandClaude Opus 5.5 committed 2026-10-15 14:38:59 +03:00
1 parent aac104206b
commit dc8409f872
1 file changed
+4 -1
+4 -1
View File
@@ -9,6 +9,9 @@ import random
import time
RUN_SPEED = 320 # QL ground run speed, units/s
# Ground friction takes ~25% of the velocity we set before the frame's move happens (measured:
# 288 set -> ~220 actual), so we set this much more to end up at the wanted speed.
FRICTION_COMP = 1.3
KEYS = ["strafe_min", "strafe_max", "fake", "range", "range_play", "speed"]
LIMITS = {"strafe_min": (50, 2000), "strafe_max": (50, 2000), "fake": (0, 100),
@@ -180,7 +183,7 @@ if minqlx:
want = wanted_range(s, bot.health, target.health)
vx, vy = steer((bpos.x, bpos.y), (tpos.x, tpos.y), direction, s, want)
vel = bot.velocity()
bot.velocity(x=vx, y=vy, z=fix_z(vel.z))
bot.velocity(x=vx * FRICTION_COMP, y=vy * FRICTION_COMP, z=fix_z(vel.z))
if self.debug:
self.debug_line(now, vel, (vx, vy), tpos, bpos, want, direction)