Add click-to-walk waypoint source.
#3
by masterjedi1337 - opened
Click-to-walk waypoint control (runtime only, no new policy)
Left-click a point on the arena floor and the duck walks (or skates) there. The click is turned into the same [vx, 0, wz] twist command the locomotion policies already track, so no retraining is involved. Works in both variants: legs and rollers.
How it works
- New WaypointSource (app/src/game/controls/waypoint.js) raycasts the click onto the floor plane, clamps the target inside the arena, then steers each frame: proportional yaw toward the target, forward speed scaled by cos(heading error) so the duck turns in place first, commands EMA-smoothed and clamped to the trained velocity limits. A 0.12 m dead zone stops it on arrival (all-zero command = trained "stand still").
- Click vs. drag disambiguation: a target only arms on a short, low-movement mouse press, so camera orbit and duck/ball grab-drags are untouched. Suppressed in head mode, during roll/kick actions, while grabbing, or when input is locked.
- Arbitration: registered last in the controller's source list, so keyboard/gamepad/touch preempt it instantly, and any manual input cancels the pending target (no snap-back to a stale click). Sim reset also cancels it.
- Feedback: a pulsing orange ring marks the active target; the cursor shows a crosshair over clickable floor.
- Small refactor: trunk-yaw-from-quaternion extraction now shared as duckYaw() in game.js (chase cam, camera reset, and the waypoint follower all use it).
Tested manually in both leg (walking) and roller (skating) variants.
masterjedi1337 changed pull request status to open
Click to walk in action
merged into main as f4264f8 (cherry-picked, you keep authorship). applied cleanly on top of our recent refactors and works great in both legs and rollers - the click-vs-drag budgets and the source arbitration slotted right into the controller. thanks for the solid writeup and the demo video!
tfrere changed pull request status to closed