mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-20 08:33:46 +00:00
Made vertical camera bias same as horizontal
This commit is contained in:
parent
9548688850
commit
7de1387d84
1 changed files with 6 additions and 1 deletions
|
|
@ -126,6 +126,10 @@ public partial class CameraController : Camera2D
|
||||||
|
|
||||||
private Vector2 GetAimDirection()
|
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
|
// Check controller stick input
|
||||||
Vector2 stickDir = new Vector2(
|
Vector2 stickDir = new Vector2(
|
||||||
Input.GetActionStrength(AimRightName) - Input.GetActionStrength(AimLeftName),
|
Input.GetActionStrength(AimRightName) - Input.GetActionStrength(AimLeftName),
|
||||||
|
|
@ -142,7 +146,8 @@ public partial class CameraController : Camera2D
|
||||||
// Mouse input
|
// Mouse input
|
||||||
Vector2 screenCenter = GetViewportRect().Size / 2f;
|
Vector2 screenCenter = GetViewportRect().Size / 2f;
|
||||||
Vector2 mousePos = GetViewport().GetMousePosition();
|
Vector2 mousePos = GetViewport().GetMousePosition();
|
||||||
Vector2 dir = mousePos - screenCenter;
|
mousePos = mousePos.Clamp(Vector2.Zero, screenSize);
|
||||||
|
Vector2 dir = (mousePos - screenCenter) * aspectFix;
|
||||||
float dist = dir.Length();
|
float dist = dir.Length();
|
||||||
|
|
||||||
// Use a pixel-based deadzone for mouse
|
// Use a pixel-based deadzone for mouse
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue