diff --git a/Assets/Scripts/Net/PlayerDriver.cs b/Assets/Scripts/Net/PlayerDriver.cs index 640f4f5..0691292 100644 --- a/Assets/Scripts/Net/PlayerDriver.cs +++ b/Assets/Scripts/Net/PlayerDriver.cs @@ -32,6 +32,7 @@ using Unity.Netcode; using UnityEngine; +using UnityEngine.InputSystem; namespace Jankenbots.Net { @@ -83,12 +84,18 @@ namespace Jankenbots.Net // host, for capsules it doesn't own) skips input entirely — IsOwner is the gate. if (!IsOwner) return; - // Throwaway-prototype input: legacy Input axes are perfectly fine here. WASD / arrows - // / left stick map to Horizontal + Vertical out of the box. (The project ships the new - // Input System, but its compatibility mode feeds these same axes, so this Just Works - // for M1 without authoring an action asset.) - float strafe = Input.GetAxisRaw("Horizontal"); // A/D, left-stick X - float fwd = Input.GetAxisRaw("Vertical"); // W/S, left-stick Y + // Throwaway-prototype input via the new Input System. The project ships New-only, so + // legacy UnityEngine.Input.GetAxis would THROW at runtime — read WASD / arrow keys + // straight off the current keyboard instead. No action asset needed for an M1 smoke test. + var kb = Keyboard.current; + float strafe = 0f, fwd = 0f; + if (kb != null) + { + if (kb.aKey.isPressed || kb.leftArrowKey.isPressed) strafe -= 1f; // left + if (kb.dKey.isPressed || kb.rightArrowKey.isPressed) strafe += 1f; // right + if (kb.wKey.isPressed || kb.upArrowKey.isPressed) fwd += 1f; // forward + if (kb.sKey.isPressed || kb.downArrowKey.isPressed) fwd -= 1f; // back + } Vector2 input = new Vector2(strafe, fwd); // Normalize so diagonal input isn't ~1.4x faster; keep magnitude for analog sticks.