diff --git a/objects/Item.cs b/objects/Item.cs index 277cab9..d45e47e 100644 --- a/objects/Item.cs +++ b/objects/Item.cs @@ -78,18 +78,19 @@ public partial class Item : RigidBody3D if (player.Pickup.HasItemsHeld) return; // TODO: Check if player is in range. + var localTransform = player.Pickup.GlobalBasis.Inverse() * GlobalBasis; RPC.ToAll().Send(Manager.RelayAccept, GetPath(), ItemManager.AcceptFunc.AcceptPickup, - new Godot.Collections.Array { player.PeerId }); - // RPC.ToAll().Send(AcceptPickup, player.PeerId); + new Godot.Collections.Array { player.PeerId, localTransform }); + // RPC.ToAll().Send(AcceptPickup, player.PeerId, localTransform); } [Rpc(CallLocal = true)] - void AcceptPickup(int peerId) + void AcceptPickup(int peerId, Transform3D localTransform) { var player = Game.Players.ByPeerId(peerId); Reparent(player.Pickup); - Transform = Transform3D.Identity; // TODO: Rotate item? + Transform = localTransform; }