some shader work and improved mantle feel

This commit is contained in:
2026-01-11 17:09:58 +01:00
parent f2a39316ba
commit 1eb65d1520
13 changed files with 65 additions and 25 deletions

View File

@@ -801,6 +801,11 @@ public partial class PlayerController : CharacterBody3D
private Transform3D _customMantleStartTransform;
private Curve3D _customMantleCurve;
private Vector3 _mantleStartPosition;
private Vector3 _velocityOnMantleStarted = Vector3.Zero;
private bool _mantleEndedOnOtherSideOfWall = false;
private bool _mantleFoundGround = false;
public void OnMantleStarted()
{
HeadSystem.OnMantle();
@@ -811,17 +816,22 @@ public partial class PlayerController : CharacterBody3D
GD.PrintErr("Failed to instantiate MantlePath");
return;
}
_velocityOnMantleStarted = Velocity;
var transform = _customMantle ? _customMantleStartTransform : MantleSystem.GlobalTransform;
var curve = _customMantle ? _customMantleCurve : MantleSystem.MantleCurve;
_mantleEndedOnOtherSideOfWall = _customMantle ? _mantleEndedOnOtherSideOfWall : MantleSystem.EndedOnOtherSideOfWall;
_mantleFoundGround = _customMantle ? _mantleFoundGround : MantleSystem.FoundGround;
GetTree().GetRoot().AddChild(_mantlePath);
_mantlePath.Setup(transform, curve);
_mantleStartPosition = GlobalPosition;
var curveLength = curve.GetBakedLength();
var tween = GetTree().CreateTween();
tween.SetTrans(Tween.TransitionType.Linear);
tween.SetEase(Tween.EaseType.InOut);
tween.TweenProperty(_mantlePath.PathFollow, "progress_ratio", 1, MantleTime);
tween.SetEase(Tween.EaseType.In);
tween.TweenProperty(_mantlePath.PathFollow, "progress_ratio", 1, MantleTime*curveLength);
tween.Finished += MantleFinished;
}
@@ -843,13 +853,17 @@ public partial class PlayerController : CharacterBody3D
public void MantleFinished()
{
_mantlePath.Teardown();
// SetVelocity(_finalCurveDirection.Normalized() * _speedOverCurve);
var isThereMovementInput = GetMoveInput().Length() > 0;
if (isThereMovementInput)
{
// If there's a movement input on Mantle, we dash in the direction the mantle took place
// If there's a movement input on Mantle, we dash in the direction the mantle ended with
var positionDifference = GlobalPosition - _mantleStartPosition;
var directionHorizontal = new Vector3(positionDifference.X, 0, positionDifference.Z);
SimpleDashInDirection(directionHorizontal.Normalized());
// SimpleDashInDirection(directionHorizontal.Normalized());
SetVelocity(directionHorizontal.Normalized() * WalkSpeed);
}
_customMantle = false;
@@ -1124,6 +1138,8 @@ public partial class PlayerController : CharacterBody3D
_customMantle = DashSystem.ShouldMantle;
_customMantleCurve = DashSystem.MantleSystem.MantleCurve;
_customMantleStartTransform = DashSystem.MantleSystem.GlobalTransform;
_mantleEndedOnOtherSideOfWall = DashSystem.MantleSystem.EndedOnOtherSideOfWall;
_mantleFoundGround = DashSystem.MantleSystem.FoundGround;
}
Tween CreatePositionTween(Vector3 targetLocation, float tweenTime)