wall run, keyboard controls, mouse sensitivity setting, and more
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 19s
Create tag and build when new code gets to main / Export (push) Successful in 6m15s

This commit is contained in:
2025-11-13 22:38:44 +01:00
parent 27130257c9
commit ac14352e7f
13 changed files with 499 additions and 87 deletions

View File

@@ -12,44 +12,47 @@ public partial class WallHugSystem : Node3D
public delegate void WallDetectedEventHandler();
private List<RayCast3D> _raycasts;
public Option<Vector3> WallHugLocation { get; private set; } = Option<Vector3>.None;
public Option<Vector3> WallHugNormal { get; private set; } = Option<Vector3>.None;
public void Init()
{
_raycasts = new List<RayCast3D>();
_raycasts.Add(GetNode<RayCast3D>("front"));
_raycasts.Add(GetNode<RayCast3D>("front2"));
_raycasts.Add(GetNode<RayCast3D>("back"));
_raycasts.Add(GetNode<RayCast3D>("back2"));
_raycasts.Add(GetNode<RayCast3D>("left"));
_raycasts.Add(GetNode<RayCast3D>("left2"));
_raycasts.Add(GetNode<RayCast3D>("right"));
_raycasts.Add(GetNode<RayCast3D>("right2"));
}
public override void _PhysicsProcess(double delta)
{
base._PhysicsProcess(delta);
CheckWallHugging();
if (IsWallHugging())
EmitSignal(SignalName.WallDetected);
}
public bool IsWallHugging()
public void CheckWallHugging()
{
foreach (RayCast3D raycast in _raycasts)
{
if (raycast.IsColliding())
{
return true;
WallHugLocation = raycast.GetCollisionPoint().Some();
WallHugNormal = raycast.GetCollisionNormal().Some();
return;
}
}
return false;
WallHugLocation = Option<Vector3>.None;
WallHugNormal = Option<Vector3>.None;
}
public Option<Vector3> GetWallNormal()
public bool IsWallHugging()
{
foreach (RayCast3D raycast in _raycasts)
{
if (raycast.IsColliding())
{
return raycast.GetCollisionNormal().Some();
}
}
return Option<Vector3>.None;
return !WallHugLocation.IsNone;
}
}