🚧 WIP: trying to rework the detection system (it fails)

This commit is contained in:
2025-12-09 17:51:00 +01:00
parent bef54420e4
commit 9499c27444
12 changed files with 106 additions and 17 deletions
@@ -7,7 +7,8 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
/// </summary>
public partial class DetectionCross : Node2D
{
[Export] private Detector _detector;
[Export] private Detector _collider;
[Export] private RaycastDetector _detector;
[Export] private float _xOffset;
[Export] private float _yOffset;
@@ -17,6 +18,8 @@ public partial class DetectionCross : Node2D
/// <param name="direction"></param>
public void SetDirection(Vector2 direction)
{
_detector.Position = new Vector2(direction.X * _xOffset, direction.Y * _yOffset);
Vector2 newPos = new Vector2(direction.X * _xOffset, direction.Y * _yOffset);
_collider.GlobalPosition = newPos;
_detector.TargetPosition = newPos;
}
}