From 38e996abaafaee93757f54e0396f8087578d33a5 Mon Sep 17 00:00:00 2001 From: Minimata Date: Sun, 8 Jun 2025 08:58:30 +0200 Subject: [PATCH] fix: now hanging on walls of all orientations --- player_controller/Scripts/PlayerController.cs | 6 ++++-- systems/weapon/WeaponSystem.cs | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/player_controller/Scripts/PlayerController.cs b/player_controller/Scripts/PlayerController.cs index de7ffd6..cfabad5 100644 --- a/player_controller/Scripts/PlayerController.cs +++ b/player_controller/Scripts/PlayerController.cs @@ -152,7 +152,7 @@ public partial class PlayerController : CharacterBody3D { if (WeaponSystem.FlyingState.Active) { - DashSystem.DashResolve = new DashResolveRecord(false, WeaponSystem.PlayerDashLocation, Vector3.Zero); + DashSystem.DashResolve = new DashResolveRecord(false, WeaponSystem.GlobalPosition, Vector3.Zero); } else if (WeaponSystem.PlantedState.Active) { @@ -160,6 +160,7 @@ public partial class PlayerController : CharacterBody3D DashSystem.DashResolve = new DashResolveRecord(false, WeaponSystem.PlayerDashLocation, Vector3.Zero); } _dashDirection = (DashSystem.DashResolve.DashLocation - GlobalPosition).Normalized(); + GD.Print(_dashDirection); DashSystem.Dash(); } @@ -186,7 +187,8 @@ public partial class PlayerController : CharacterBody3D } // Store the weapon state before resetting it - var isPlantedOnWall = WeaponSystem.PlantedState.Active && WeaponSystem.GlobalRotation.Dot(Vector3.Up) < 0.1; + var isPlantedOnWall = WeaponSystem.PlantedState.Active + && (Math.Abs(WeaponSystem.GlobalRotation.X) + Math.Abs(WeaponSystem.GlobalRotation.Z) < 0.3); var isFlying = WeaponSystem.FlyingState.Active; // Get the weapon back diff --git a/systems/weapon/WeaponSystem.cs b/systems/weapon/WeaponSystem.cs index dd3b4f4..9e9dc49 100644 --- a/systems/weapon/WeaponSystem.cs +++ b/systems/weapon/WeaponSystem.cs @@ -73,6 +73,7 @@ public partial class WeaponSystem : RigidBody3D _weaponState.SendEvent("plant"); Freeze = true; GlobalPosition = _plantLocation; + PlayerDashLocation = _plantLocation + _plantNormal * 0.1f; LookAt(GlobalTransform.Origin + _plantNormal, Vector3.Up, true); }