refactor: restructure interaction system into clean layers
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
|
||||
namespace Game.Features.Interactions.Domain;
|
||||
|
||||
public readonly record struct DropRayHit(
|
||||
Vector3 Origin,
|
||||
Vector3 Direction,
|
||||
float RayLength,
|
||||
bool IsBlocked,
|
||||
Vector3 BlockPoint
|
||||
);
|
||||
|
||||
public static class DropPosition
|
||||
{
|
||||
public static Vector3 CalculateFrom(DropRayHit hit)
|
||||
{
|
||||
float distance = hit.RayLength;
|
||||
|
||||
if (hit.IsBlocked)
|
||||
{
|
||||
distance = Mathf.Max(0.25f, hit.Origin.DistanceTo(hit.BlockPoint) - 0.2f);
|
||||
}
|
||||
|
||||
return hit.Origin + hit.Direction * distance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user