Fix mobile restart and swipe aiming while firing

This commit is contained in:
enne2
2026-10-11 00:13:06 +02:00
parent dee0b387ba
commit f246ede94f
5 changed files with 107 additions and 7 deletions
+19 -1
View File
@@ -31,7 +31,25 @@ carries a single pointer and would break simultaneous aiming and firing.
- left half: floating joystick (its base recenters where the finger lands), feeds the analog
`move_*` actions;
- right half: look area, drag rotates the view through `player.apply_look()`;
- bottom right: FIRE (hold to keep shooting), GRENADE, RELOAD, JUMP.
- bottom right: FIRE (hold and drag to shoot AND aim), GRENADE, RELOAD, JUMP.
- game over: controls release all actions and hide; a central RICOMINCIA button
handles native screen touches even with mouse emulation disabled. A 0.6-second
guard prevents the killing-frame gesture from accidentally restarting.
### Swipe aiming
Prefer direct swipe displacement to a rate-based right stick: releasing the thumb
stops rotation immediately. FIRE also acts as a look pad, so two thumbs can move,
aim and shoot simultaneously. This follows the combined action/touchpad pattern in
[Microsoft's designer guide](https://learn.microsoft.com/en-us/gaming/gdk/docs/features/common/game-streaming/building-touch-layouts/game-streaming-tak-designers-guide).
Use `InputEventScreenDrag.screen_relative`, not stretch-scaled `relative`, as
[Godot explicitly recommends for touch aiming](https://docs.godotengine.org/en/stable/classes/class_inputeventscreendrag.html).
Normalize by the physical window width: one full-width swipe turns 180 degrees;
vertical gain is 75% for finer pitch control. No time delta or acceleration is
applied (these are displacements), no smoothing latency, desktop mouse unchanged.
Lift/reposition the finger without a camera jump. Constants `LOOK_TURN_RADIANS`
and `LOOK_VERTICAL_RATIO` tune the feel.
Movement uses the existing InputMap actions, so keyboard, gamepad and touch share one path. Reload,
grenade and jump are read by polling (`Input.is_action_just_pressed`) instead of by event handling: