From 6c2ad8968767e7ceea875a2ddc5f4847fc57b98a Mon Sep 17 00:00:00 2001 From: Minimata Date: Tue, 6 Jan 2026 12:36:38 +0100 Subject: [PATCH] fixing the manlting into geo --- maps/city.tscn | 4 ++- player_controller/PlayerController.tscn | 3 +-- player_controller/Scripts/PlayerController.cs | 11 +++++--- systems/mantle/MantleSystem.cs | 25 +++++++++++++------ systems/mantle/mantle_system.tscn | 14 +++++------ 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/maps/city.tscn b/maps/city.tscn index 11750e78..ad494f58 100644 --- a/maps/city.tscn +++ b/maps/city.tscn @@ -102,6 +102,7 @@ player = NodePath("../Player") pause = ExtResource("10_0ari0") [node name="TutorialController" type="Control" parent="."] +visible = false layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -374,9 +375,10 @@ shadow_opacity = 0.95 shadow_blur = 2.435 [node name="Player" parent="." node_paths=PackedStringArray("TutorialWeaponTarget") instance=ExtResource("1_2vsi6")] -transform = Transform3D(0.054514527, 0, -0.9985129, 0, 1, 0, 0.9985129, 0, 0.054514527, 0, -132.75, 118) +transform = Transform3D(0.054514527, 0, -0.9985129, 0, 1, 0, 0.9985129, 0, 0.054514527, -6, 75.5, -13.5) collision_layer = 17 TutorialWeaponTarget = NodePath("../PlacedTutorialWeapon/WeaponLocationTarget") +TutorialDone = true AccelerationAir = 1.5 [node name="DebugLayer" type="CanvasLayer" parent="."] diff --git a/player_controller/PlayerController.tscn b/player_controller/PlayerController.tscn index bd3cb20f..dae46026 100644 --- a/player_controller/PlayerController.tscn +++ b/player_controller/PlayerController.tscn @@ -78,7 +78,7 @@ DoubleJumpGravityLesseningFactor = 1.5 MegaJumpStartVelocity = 30.0 MegaJumpHangTimeInFrames = 12 MegaJumpGravityLesseningFactor = 1.2 -WallJumpStartVelocity = 12.0 +WallJumpStartVelocity = 8.0 MaxNumberOfEmpoweredActions = 3 SimpleDashStrength = 15.0 PoweredDashStrength = 30.0 @@ -252,7 +252,6 @@ offset_left = 1524.0 offset_top = 1.0 offset_right = -8.0 offset_bottom = 1.0 -enabled = false initial_node_to_watch = NodePath("../StateChart") [node name="UI" type="Control" parent="."] diff --git a/player_controller/Scripts/PlayerController.cs b/player_controller/Scripts/PlayerController.cs index 7eac2a1b..bce800a6 100644 --- a/player_controller/Scripts/PlayerController.cs +++ b/player_controller/Scripts/PlayerController.cs @@ -485,15 +485,17 @@ public partial class PlayerController : CharacterBody3D public void HandleAirborne(float delta) { - MoveInAir(delta); if (isOnFloorCustom()) _playerState.SendEvent("grounded"); if (IsTryingToMantle()) _playerState.SendEvent("mantle"); - + if (!WallHugSystem.IsWallHugging()) + { + _isWallJumpAvailable = true; // reset wall jump if we left the wall return; + } // Going upwards, we stay simply airborne if (Velocity.AngleTo(Vector3.Up) < Math.PI / 4) @@ -640,7 +642,10 @@ public partial class PlayerController : CharacterBody3D if (_onWallHuggingCoyoteEnabled.Active || _onWallRunningCoyoteEnabled.Active) { - if (!_isWallJumpAvailable) return; + if (!_isWallJumpAvailable) + { + OnJumpFromWall(); + } } _playerState.SendEvent("jump"); } diff --git a/systems/mantle/MantleSystem.cs b/systems/mantle/MantleSystem.cs index 147f6d2f..88c9c5f7 100644 --- a/systems/mantle/MantleSystem.cs +++ b/systems/mantle/MantleSystem.cs @@ -57,13 +57,15 @@ public partial class MantleSystem: Node3D IsMantlePossible = false; if (!isColliding) return; - // Check if collide with wall + // Check if face something wall-like that should be climbable var collisionNormal = isGrounded ? _groundedWallDetect.GetCollisionNormal(0) : _inAirWallDetect.GetCollisionNormal(0); - if (collisionNormal.Y > 0.9f) return; + if (collisionNormal.Y > 0.7f) return; + var spaceState = GetWorld3D().DirectSpaceState; MantleCurve = new Curve3D(); MantleCurve.AddPoint(Vector3.Zero); - var hasFirstProfileHit = false; + var hasFirstProfileHit = false; + var previousProfilePoint = GlobalPosition; foreach (var wallProfileShapecast in _wallProfileShapecasts) { // Haven't met the wall yet @@ -74,22 +76,31 @@ public partial class MantleSystem: Node3D // Got to the other side of the wall, we stop there if (!wallProfileShapecast.IsColliding()) { - MantleCurve.AddPoint(ToLocal(globalTargetPosition)); + // MantleCurve.AddPoint(ToLocal(globalTargetPosition)); break; } var profilePoint = wallProfileShapecast.GetCollisionPoint(0); var profileNormal = wallProfileShapecast.GetCollisionNormal(0); + var shape = wallProfileShapecast.Shape as SphereShape3D; + var shapeRadius = shape == null ? 0.125f : shape.Radius; + var centerOfShape = profilePoint + profileNormal * shapeRadius; // Check if we collided parallel to a wall - var isCollisionSameAsTarget = globalTargetPosition.IsEqualApprox(profilePoint); + var isCollisionSameAsTarget = globalTargetPosition.IsEqualApprox(centerOfShape); var isCollidingWithWall = profileNormal.Y < 0.1f; if (isCollisionSameAsTarget || isCollidingWithWall) continue; + // Check if the path from the previous point makes us go through a wall + var query = PhysicsRayQueryParameters3D.Create(previousProfilePoint, centerOfShape, wallProfileShapecast.CollisionMask); + var result = spaceState.IntersectRay(query); + if (result.Count > 0) break; // We are going through a wall, we stop there + // We have a valid collision - if (!hasFirstProfileHit) FirstMantleProfilePoint = profilePoint; + if (!hasFirstProfileHit) FirstMantleProfilePoint = centerOfShape; hasFirstProfileHit = true; - MantleCurve.AddPoint(ToLocal(profilePoint)); + previousProfilePoint = centerOfShape; + MantleCurve.AddPoint(ToLocal(centerOfShape)); } if (MantleCurve.PointCount == 1) return; diff --git a/systems/mantle/mantle_system.tscn b/systems/mantle/mantle_system.tscn index c500c62a..b396035c 100644 --- a/systems/mantle/mantle_system.tscn +++ b/systems/mantle/mantle_system.tscn @@ -58,47 +58,47 @@ collision_mask = 2 transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.5) enabled = false shape = SubResource("SphereShape3D_i32qj") -target_position = Vector3(0, -2.375, 0) +target_position = Vector3(0, -2.125, 0) collision_mask = 2 [node name="ShapeCast2" type="ShapeCast3D" parent="WallProfileShapeCasts"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.75) enabled = false shape = SubResource("SphereShape3D_i32qj") -target_position = Vector3(0, -2.375, 0) +target_position = Vector3(0, -2.125, 0) collision_mask = 2 [node name="ShapeCast3" type="ShapeCast3D" parent="WallProfileShapeCasts"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1) enabled = false shape = SubResource("SphereShape3D_i32qj") -target_position = Vector3(0, -2.375, 0) +target_position = Vector3(0, -2.125, 0) collision_mask = 2 [node name="ShapeCast4" type="ShapeCast3D" parent="WallProfileShapeCasts"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.25) enabled = false shape = SubResource("SphereShape3D_i32qj") -target_position = Vector3(0, -2.375, 0) +target_position = Vector3(0, -2.125, 0) collision_mask = 2 [node name="ShapeCast5" type="ShapeCast3D" parent="WallProfileShapeCasts"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.5) enabled = false shape = SubResource("SphereShape3D_i32qj") -target_position = Vector3(0, -2.375, 0) +target_position = Vector3(0, -2.125, 0) collision_mask = 2 [node name="ShapeCast6" type="ShapeCast3D" parent="WallProfileShapeCasts"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.75) enabled = false shape = SubResource("SphereShape3D_i32qj") -target_position = Vector3(0, -2.375, 0) +target_position = Vector3(0, -2.125, 0) collision_mask = 2 [node name="ShapeCast7" type="ShapeCast3D" parent="WallProfileShapeCasts"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -2) enabled = false shape = SubResource("SphereShape3D_i32qj") -target_position = Vector3(0, -2.375, 0) +target_position = Vector3(0, -2.125, 0) collision_mask = 2