From cec82be93bc3a3a7332d3545ee3b902e1337f77f Mon Sep 17 00:00:00 2001 From: Phyma Date: Sun, 4 Jun 2017 19:46:49 +0200 Subject: [PATCH] Raise lower carry object (#5234) * Fix to move items up and down * Fixed private * Fixed public bug * Inserted Pabst solution * Remove extra space * Fixed request + added author * Fixed to correct comment * Tweeked comment again --- AUTHORS.txt | 1 + addons/dragging/functions/fnc_handleScrollWheel.sqf | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 812324c34d..43e1eeb21e 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -104,6 +104,7 @@ nomisum OnkelDisMaster oscarmolinadev PaxJaromeMalues +Phyma pokertour Professor rakowozz diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index e3a30ea9e0..f82478d531 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -37,8 +37,12 @@ _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) // move up/down object and reattach at current position detach _carriedItem; -_carriedItem setPosATL _position; -_carriedItem attachTo [_unit]; + +// Uses this method of selecting position because setPosATL did not have immediate effect +private _positionChange = _position vectorDiff (getPosATL _carriedItem); +private _selectionPosition = _unit worldToModel (ASLtoAGL getPosWorld _carriedItem); +_selectionPosition = _selectionPosition vectorAdd _positionChange; +_carriedItem attachTo [_unit, _selectionPosition]; //reset the carry direction private _direction = _carriedItem getVariable [QGVAR(carryDirection), 0];