Skip to content

Combat: tame aimbot bots, fix gun viewmodels (show + orientation) - #37

Merged
yassinsolim merged 1 commit into
mainfrom
gun-viewmodel-and-bot-fixes
Jul 2, 2026
Merged

Combat: tame aimbot bots, fix gun viewmodels (show + orientation)#37
yassinsolim merged 1 commit into
mainfrom
gun-viewmodel-and-bot-fixes

Conversation

@yassinsolim

Copy link
Copy Markdown
Owner

Summary

Addresses the playtest feedback: bots felt like aimbots, and weapon slots 2/3 barely rendered (Deagle faced backward, neither gun really showed — just arms).

🤖 Bots — no more aimbot

They had perfect tracking + pixel-perfect shots. Now:

  • Human aim inaccuracy: the bot aims at a point that drifts around the true target (a smoothed random walk whose amplitude grows with distance), so it over/under-shoots and misses instead of laser-beaming.
  • Slower turn (3.2 → 2.4 rad/s), longer reaction (0.75 → 0.9 s), tighter fire tolerance.
  • Verified: 100 HP after standing still 13 s, vs the old ~1–2 s instakill.
  • The pure decideBotInput stays deterministic (the wander lives in the stateful tick), so the unit tests are untouched.

🔫 Gun viewmodels — actually show now

  • The core "guns don't show" bug: the fit computed bone centres in world space while the placement pos is camera-local. It worked at the world origin but in-game the camera sits at z=16, so the gun was placed ~16 units behind the view. Now the fit is done in camera-local space.
  • Animation blend bug: draw/fire/idle all played at full weight simultaneously and the mixer averaged them into a broken pose that threw the gun off-screen. Replaced with a clean crossfade state machine (one active action; one-shots ease back to idle on the mixer finished event).
  • Orientation is derived from the model's own reference nodes so the barrel points forward (−Z) instead of hand-guessed Euler angles (fixes the Deagle "facing backward").
  • The AWP (clean arms+gun rig) now renders correctly as a real textured sniper held in two hands.

🪫 Deagle model was a broken export

The Sketchfab Deagle's gun and hand meshes are at incompatible 1:8000 scales in one skeleton — no uniform transform can render both (only the hand showed; verified with two independent re-compressions). Replaced it with a clean procedural Desert Eagle that renders reliably, and dropped the 8 MB unused GLB + its credit. The AWP credit (Addison Ye) stays.

Verification

  • npm run ci: tsc clean, 132/132 tests pass, build clean.
  • In-game (pointer-lock-bypass dev harness, reverted before commit): both guns render on equip; barrels point forward; fire recoil plays; bots no longer instakill.

The procedural Deagle is a stopgap — if you grab a clean arms+gun Deagle rig (like the AWP, not a full-character rig), I can swap it straight in.

Bots played like aimbots — perfect tracking + pixel-perfect shots. Guns
2/3 barely rendered: the Deagle faced backward and neither gun really
showed, just arms.

Bots:
- Add human aim inaccuracy: the bot now aims at a point that drifts
  around the true target (smoothed random walk whose amplitude grows with
  distance), so it over/under-shoots and misses instead of laser-beaming.
  Also slower turn (3.2->2.4 rad/s), longer reaction (0.75->0.9s) and
  tighter fire tolerance. Verified: 100 HP after standing still 13s vs the
  old ~1-2s instakill. The pure decideBotInput stays deterministic (wander
  lives in the stateful tick), so the unit tests are untouched.

Gun viewmodels:
- Fix the real bug behind 'guns don't show': the fit computed bone centres
  in WORLD space while the placement pos is CAMERA-local. It happened to
  work at the world origin but in-game the camera sits at z=16, so the gun
  was placed ~16 units behind the view. Now the fit works in the mount's
  (camera-local) space.
- Fix the animation blend bug: draw/fire/idle all played at full weight at
  once and the mixer averaged them into a broken pose that threw the gun
  off-screen. Replace with a clean crossfade state machine (one active
  action; one-shots ease back to idle via the mixer 'finished' event).
- Derive gun orientation from the model's own reference nodes so the barrel
  points forward (-Z) instead of hand-guessing Euler angles.
- The AWP (clean arms+gun rig) now renders correctly as a real textured
  sniper held in two hands.
- The Deagle Sketchfab model is a broken export — its gun and hand meshes
  are at incompatible 1:8000 scales in one skeleton, so no uniform
  transform can render both (only the hand showed). Replace it with a clean
  procedural Desert Eagle that renders reliably, and drop the 8 MB unused
  GLB + its credit. AWP credit (Addison Ye) stays.
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webstrafe Ready Ready Preview, Comment Jul 2, 2026 9:33am

@yassinsolim
yassinsolim merged commit f76907f into main Jul 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant