Made vertical camera bias same as horizontal

This commit is contained in:
Marco 2025-05-07 12:01:02 +02:00
commit 7de1387d84

View file

@ -126,6 +126,10 @@ public partial class CameraController : Camera2D
private Vector2 GetAimDirection()
{
Vector2 screenSize = GetViewportRect().Size;
Vector2 aspectFix = new Vector2(1f, screenSize.X / screenSize.Y); // Stretch Y to match X range
// Check controller stick input
Vector2 stickDir = new Vector2(
Input.GetActionStrength(AimRightName) - Input.GetActionStrength(AimLeftName),
@ -142,7 +146,8 @@ public partial class CameraController : Camera2D
// Mouse input
Vector2 screenCenter = GetViewportRect().Size / 2f;
Vector2 mousePos = GetViewport().GetMousePosition();
Vector2 dir = mousePos - screenCenter;
mousePos = mousePos.Clamp(Vector2.Zero, screenSize);
Vector2 dir = (mousePos - screenCenter) * aspectFix;
float dist = dir.Length();
// Use a pixel-based deadzone for mouse