controls: on-foot always-on mouse-look + camera-relative WASD + E/Q claim

- CameraDirector: AvatarFollow now uses always-on mouse-look (no RMB) with a
  locked/hidden cursor; Esc toggles the cursor free; RobotFollow keeps RMB-look.
- PlayerAvatar: movement is camera-relative (W = camera forward, character turns
  to face where it runs) instead of world/cardinal.
- PlayerAvatar: E claims a tread on foot, Q leaves while seated (locked cursor
  makes the OnGUI buttons unclickable).
- Verified in play: cursor locks in on-foot mode, camera-relative basis correct,
  no runtime errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-07-12 21:02:22 +01:00
parent 3082644dbd
commit 30d0b27813
2 changed files with 33 additions and 3 deletions

View file

@ -61,6 +61,7 @@ namespace Jankenbots.Prototype
float _pitch = 18f;
float _dist = 8f;
float _cineAngle;
bool _cursorFree; // Esc toggles the locked cursor free (for GUI / to escape play)
PlayerAvatar _local;
@ -115,13 +116,21 @@ namespace Jankenbots.Prototype
if (want != _mode) { _mode = want; Apply(_mode); }
}
// Look / zoom input — only for the orbitable follow cams.
// Cursor + look. On-foot (AvatarFollow) uses ALWAYS-ON mouse-look with a
// locked cursor (no RMB needed); other modes keep the cursor free (RobotFollow
// orbits while RMB is held). Esc toggles the cursor free to reach GUI / escape.
if (kb != null && kb.escapeKey.wasPressedThisFrame) _cursorFree = !_cursorFree;
bool avatarLook = _mode == Mode.AvatarFollow && !_cursorFree;
Cursor.lockState = avatarLook ? CursorLockMode.Locked : CursorLockMode.None;
Cursor.visible = !avatarLook;
if (_mode == Mode.AvatarFollow || _mode == Mode.RobotFollow)
{
var m = Mouse.current;
if (m != null)
{
if (m.rightButton.isPressed)
bool look = _mode == Mode.AvatarFollow ? avatarLook : m.rightButton.isPressed;
if (look)
{
Vector2 d = m.delta.ReadValue();
_yaw += d.x * lookSensitivity;