diff --git a/player/PickupController.cs b/player/PickupController.cs index 6e7670c..11ef40f 100644 --- a/player/PickupController.cs +++ b/player/PickupController.cs @@ -87,8 +87,16 @@ public partial class PickupController : Node3D if (!_player.IsLocal) return; EnsureCurrentItemValid(); + static bool CanPlaceAgainst(Grid grid, Vector3 normal) + { + normal = grid.GlobalBasis.Inverse() * normal; + return normal.IsEqualApprox(Vector3.Up); + } + if (HasItemsHeld) { if ((RayToMouseCursor() is RayResult ray) && (ray.Collider is Grid grid) + // Make sure this is placed against the top of the grid. + && CanPlaceAgainst(grid, ray.Normal) // Ensure item is not being added to itself or nested items. && !((grid.GetParent() == CurrentItem) || grid.ContainsItem(CurrentItem))) { var transform = CurrentItem.GlobalTransform with { Origin = ray.Position };