From bec2cd53232d595c18eefd9e9c9d11ceb94aac08 Mon Sep 17 00:00:00 2001 From: ursinewalrus Date: Tue, 31 Jul 2018 19:46:55 -0500 Subject: [PATCH] more accurate placement --- .../Source/Items/Components/Holdable/Holdable.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs index 726c94ebc..3159deed5 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs @@ -161,17 +161,24 @@ namespace Barotrauma.Items.Components { item.body.ResetDynamics(); Limb heldHand; + Limb arm; if (picker.Inventory.IsInLimbSlot(item, InvSlotType.LeftHand)) { heldHand = picker.AnimController.GetLimb(LimbType.LeftHand); + arm = picker.AnimController.GetLimb(LimbType.LeftArm); } else { heldHand = picker.AnimController.GetLimb(LimbType.RightHand); + arm = picker.AnimController.GetLimb(LimbType.RightArm); } + float xDif = (heldHand.SimPosition.X - arm.SimPosition.X) / 2f; + float yDif = (heldHand.SimPosition.Y - arm.SimPosition.Y) / 2.5f; - item.SetTransform(heldHand.SimPosition, 0.0f); + + //DebugConsole.NewMessage("hand rot at " + heldHand.SimPosition + " and simpos at " + arm, Color.Green); + item.SetTransform(heldHand.SimPosition + new Vector2(xDif,yDif), 0.0f); } picker.DeselectItem(item);