some shader work and improved mantle feel
This commit is contained in:
@@ -21,6 +21,8 @@ public partial class MantleSystem: Node3D
|
||||
public Vector3 FirstMantleProfilePoint { get; private set; } = Vector3.Zero;
|
||||
|
||||
public bool IsMantlePossible { get; private set; } = false;
|
||||
public bool EndedOnOtherSideOfWall { get; private set; } = false;
|
||||
public bool FoundGround { get; private set; } = false;
|
||||
public const int WallProfileCastCount = 7;
|
||||
|
||||
private ShapeCast3D[] _wallProfileShapecasts = new ShapeCast3D[WallProfileCastCount];
|
||||
@@ -55,6 +57,8 @@ public partial class MantleSystem: Node3D
|
||||
|
||||
// Reset state
|
||||
IsMantlePossible = false;
|
||||
EndedOnOtherSideOfWall = false;
|
||||
FoundGround = false;
|
||||
if (!isColliding) return;
|
||||
|
||||
// Check if face something wall-like that should be climbable
|
||||
@@ -62,6 +66,7 @@ public partial class MantleSystem: Node3D
|
||||
if (collisionNormal.Y > 0.7f) return;
|
||||
|
||||
var spaceState = GetWorld3D().DirectSpaceState;
|
||||
|
||||
MantleCurve = new Curve3D();
|
||||
MantleCurve.AddPoint(Vector3.Zero);
|
||||
var hasFirstProfileHit = false;
|
||||
@@ -76,7 +81,19 @@ public partial class MantleSystem: Node3D
|
||||
// Got to the other side of the wall, we stop there
|
||||
if (!wallProfileShapecast.IsColliding())
|
||||
{
|
||||
// MantleCurve.AddPoint(ToLocal(globalTargetPosition));
|
||||
/*EndedOnOtherSideOfWall = true;
|
||||
|
||||
var origin = globalTargetPosition;
|
||||
var end = origin + Vector3.Down*0.51f; // We check for the ground a bit below our target
|
||||
var groundQuery = PhysicsRayQueryParameters3D.Create(origin, end, wallProfileShapecast.CollisionMask);
|
||||
var groundResult = spaceState.IntersectRay(groundQuery);
|
||||
if (groundResult.Count > 0)
|
||||
{
|
||||
// We found the ground, this is our final location
|
||||
FoundGround = true;
|
||||
Vector3 position = (Vector3) groundResult["position"];
|
||||
MantleCurve.AddPoint(ToLocal(position));
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user