fixing the manlting into geo
This commit is contained in:
@@ -102,6 +102,7 @@ player = NodePath("../Player")
|
|||||||
pause = ExtResource("10_0ari0")
|
pause = ExtResource("10_0ari0")
|
||||||
|
|
||||||
[node name="TutorialController" type="Control" parent="."]
|
[node name="TutorialController" type="Control" parent="."]
|
||||||
|
visible = false
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -374,9 +375,10 @@ shadow_opacity = 0.95
|
|||||||
shadow_blur = 2.435
|
shadow_blur = 2.435
|
||||||
|
|
||||||
[node name="Player" parent="." node_paths=PackedStringArray("TutorialWeaponTarget") instance=ExtResource("1_2vsi6")]
|
[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
|
collision_layer = 17
|
||||||
TutorialWeaponTarget = NodePath("../PlacedTutorialWeapon/WeaponLocationTarget")
|
TutorialWeaponTarget = NodePath("../PlacedTutorialWeapon/WeaponLocationTarget")
|
||||||
|
TutorialDone = true
|
||||||
AccelerationAir = 1.5
|
AccelerationAir = 1.5
|
||||||
|
|
||||||
[node name="DebugLayer" type="CanvasLayer" parent="."]
|
[node name="DebugLayer" type="CanvasLayer" parent="."]
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ DoubleJumpGravityLesseningFactor = 1.5
|
|||||||
MegaJumpStartVelocity = 30.0
|
MegaJumpStartVelocity = 30.0
|
||||||
MegaJumpHangTimeInFrames = 12
|
MegaJumpHangTimeInFrames = 12
|
||||||
MegaJumpGravityLesseningFactor = 1.2
|
MegaJumpGravityLesseningFactor = 1.2
|
||||||
WallJumpStartVelocity = 12.0
|
WallJumpStartVelocity = 8.0
|
||||||
MaxNumberOfEmpoweredActions = 3
|
MaxNumberOfEmpoweredActions = 3
|
||||||
SimpleDashStrength = 15.0
|
SimpleDashStrength = 15.0
|
||||||
PoweredDashStrength = 30.0
|
PoweredDashStrength = 30.0
|
||||||
@@ -252,7 +252,6 @@ offset_left = 1524.0
|
|||||||
offset_top = 1.0
|
offset_top = 1.0
|
||||||
offset_right = -8.0
|
offset_right = -8.0
|
||||||
offset_bottom = 1.0
|
offset_bottom = 1.0
|
||||||
enabled = false
|
|
||||||
initial_node_to_watch = NodePath("../StateChart")
|
initial_node_to_watch = NodePath("../StateChart")
|
||||||
|
|
||||||
[node name="UI" type="Control" parent="."]
|
[node name="UI" type="Control" parent="."]
|
||||||
|
|||||||
@@ -485,7 +485,6 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
public void HandleAirborne(float delta)
|
public void HandleAirborne(float delta)
|
||||||
{
|
{
|
||||||
|
|
||||||
MoveInAir(delta);
|
MoveInAir(delta);
|
||||||
if (isOnFloorCustom())
|
if (isOnFloorCustom())
|
||||||
_playerState.SendEvent("grounded");
|
_playerState.SendEvent("grounded");
|
||||||
@@ -493,7 +492,10 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
||||||
|
|
||||||
if (!WallHugSystem.IsWallHugging())
|
if (!WallHugSystem.IsWallHugging())
|
||||||
|
{
|
||||||
|
_isWallJumpAvailable = true; // reset wall jump if we left the wall
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Going upwards, we stay simply airborne
|
// Going upwards, we stay simply airborne
|
||||||
if (Velocity.AngleTo(Vector3.Up) < Math.PI / 4)
|
if (Velocity.AngleTo(Vector3.Up) < Math.PI / 4)
|
||||||
@@ -640,7 +642,10 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
if (_onWallHuggingCoyoteEnabled.Active || _onWallRunningCoyoteEnabled.Active)
|
if (_onWallHuggingCoyoteEnabled.Active || _onWallRunningCoyoteEnabled.Active)
|
||||||
{
|
{
|
||||||
if (!_isWallJumpAvailable) return;
|
if (!_isWallJumpAvailable)
|
||||||
|
{
|
||||||
|
OnJumpFromWall();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_playerState.SendEvent("jump");
|
_playerState.SendEvent("jump");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,13 +57,15 @@ public partial class MantleSystem: Node3D
|
|||||||
IsMantlePossible = false;
|
IsMantlePossible = false;
|
||||||
if (!isColliding) return;
|
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);
|
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 = new Curve3D();
|
||||||
MantleCurve.AddPoint(Vector3.Zero);
|
MantleCurve.AddPoint(Vector3.Zero);
|
||||||
var hasFirstProfileHit = false;
|
var hasFirstProfileHit = false;
|
||||||
|
var previousProfilePoint = GlobalPosition;
|
||||||
foreach (var wallProfileShapecast in _wallProfileShapecasts)
|
foreach (var wallProfileShapecast in _wallProfileShapecasts)
|
||||||
{
|
{
|
||||||
// Haven't met the wall yet
|
// 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
|
// Got to the other side of the wall, we stop there
|
||||||
if (!wallProfileShapecast.IsColliding())
|
if (!wallProfileShapecast.IsColliding())
|
||||||
{
|
{
|
||||||
MantleCurve.AddPoint(ToLocal(globalTargetPosition));
|
// MantleCurve.AddPoint(ToLocal(globalTargetPosition));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var profilePoint = wallProfileShapecast.GetCollisionPoint(0);
|
var profilePoint = wallProfileShapecast.GetCollisionPoint(0);
|
||||||
var profileNormal = wallProfileShapecast.GetCollisionNormal(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
|
// Check if we collided parallel to a wall
|
||||||
var isCollisionSameAsTarget = globalTargetPosition.IsEqualApprox(profilePoint);
|
var isCollisionSameAsTarget = globalTargetPosition.IsEqualApprox(centerOfShape);
|
||||||
var isCollidingWithWall = profileNormal.Y < 0.1f;
|
var isCollidingWithWall = profileNormal.Y < 0.1f;
|
||||||
if (isCollisionSameAsTarget || isCollidingWithWall) continue;
|
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
|
// We have a valid collision
|
||||||
if (!hasFirstProfileHit) FirstMantleProfilePoint = profilePoint;
|
if (!hasFirstProfileHit) FirstMantleProfilePoint = centerOfShape;
|
||||||
hasFirstProfileHit = true;
|
hasFirstProfileHit = true;
|
||||||
MantleCurve.AddPoint(ToLocal(profilePoint));
|
previousProfilePoint = centerOfShape;
|
||||||
|
MantleCurve.AddPoint(ToLocal(centerOfShape));
|
||||||
}
|
}
|
||||||
if (MantleCurve.PointCount == 1) return;
|
if (MantleCurve.PointCount == 1) return;
|
||||||
|
|
||||||
|
|||||||
@@ -58,47 +58,47 @@ collision_mask = 2
|
|||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.5)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.375, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="ShapeCast2" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast2" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.75)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.75)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.375, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="ShapeCast3" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast3" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.375, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="ShapeCast4" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast4" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.25)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.25)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.375, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="ShapeCast5" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast5" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.5)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.375, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="ShapeCast6" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast6" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.75)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.75)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.375, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="ShapeCast7" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast7" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -2)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -2)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.375, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|||||||
Reference in New Issue
Block a user