From 4868aacb42c6a8107c6ceffe3e4fd3f99a1636ab Mon Sep 17 00:00:00 2001 From: jonpas Date: Thu, 27 Oct 2016 23:23:03 +0200 Subject: [PATCH 01/10] Move objects with disabled simulation to ground In addition to simulation type house, disabled simulation objects will also be floating - this is usually done to prevent clipping or falling of small objects objects through objects they are placed on --- addons/common/functions/fnc_fixPosition.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_fixPosition.sqf b/addons/common/functions/fnc_fixPosition.sqf index 883a502c4e..a678965d88 100644 --- a/addons/common/functions/fnc_fixPosition.sqf +++ b/addons/common/functions/fnc_fixPosition.sqf @@ -16,8 +16,8 @@ // setVectorUp requires local object if (!local _this) exitWith {}; -if ((getText (configFile >> "CfgVehicles" >> (typeOf _this) >> "simulation")) == "house") then { - //Houses don't have gravity/physics, so make sure they are not floating +// Objects with disabled simulation and objects with simulation type "house" don't have gravity/physics, so make sure they are not floating +if (!simulationEnabled _this || {getText (configFile >> "CfgVehicles" >> (typeOf _this) >> "simulation") == "house"}) then { private _posAbove = (getPos _this) select 2; TRACE_2("house",_this,_posAbove); if (_posAbove > 0.1) then { From e83791c2467b3d0d2e502e9b5f70b4534e7e5918 Mon Sep 17 00:00:00 2001 From: jonpas Date: Thu, 27 Oct 2016 23:30:40 +0200 Subject: [PATCH 02/10] Fix carrying direction for Land_WoodenBox_F --- addons/dragging/CfgVehicles.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index c8e3c7284a..bc0372285a 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -170,7 +170,7 @@ class CfgVehicles { }; GVAR(canCarry) = 1; GVAR(carryPosition[]) = {0,1,1}; - GVAR(carryDirection) = 270; + GVAR(carryDirection) = 0; GVAR(canDrag) = 1; GVAR(dragPosition[]) = {0,1.4,0}; From e400a68427dfde57ffff6fe45d2c4dc5ea10a264 Mon Sep 17 00:00:00 2001 From: jonpas Date: Fri, 28 Oct 2016 00:06:35 +0200 Subject: [PATCH 03/10] Disable collision with nearby players while carrying --- addons/dragging/functions/fnc_carryObject.sqf | 2 +- .../dragging/functions/fnc_carryObjectPFH.sqf | 30 +++++++++++++++++-- .../dragging/functions/fnc_dragObjectPFH.sqf | 2 +- addons/dragging/script_component.hpp | 4 ++- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index 985f3ddab6..e189cf242d 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -67,7 +67,7 @@ if (_target isKindOf "CAManBase") then { }; // check everything -[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; +[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime, []]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index 963921efa7..c0b31dfa80 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -1,5 +1,5 @@ /* - * Author: commy2 + * Author: commy2, Jonpas * PFH for Carry Object * * Arguments: @@ -24,7 +24,7 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit","_target", "_startTime"]; +_args params ["_unit","_target", "_startTime", "_disabledCollisionObjects"]; if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { TRACE_2("carry false",_unit,_target); @@ -35,10 +35,34 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { if (!alive _target || {_unit distance _target > 10}) then { TRACE_2("dead/distance",_unit,_target); if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith { - //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime); }; [_unit, _target] call FUNC(dropObject_carry); [_idPFH] call CBA_fnc_removePerFrameHandler; }; + + +// Disable collision with nearby players +TRACE_1("Disable collision objects",_disabledCollisionObjects); +private _nearUnits = _target nearObjects ["CAManBase", DISABLE_COLLISION_DISTANCE]; +{ + if !(_x in _disabledCollisionObjects) then { + TRACE_2("Adding disable collision object",_x,typeOf _x); + _target disableCollisionWith _x; + _disabledCollisionObjects pushBack _x; + }; +} count _nearUnits; + +_disabledCollisionObjects = _disabledCollisionObjects select { + if (_x in _nearUnits) then { + true + } else { + TRACE_2("Removing disable collision object",_x,typeOf _x); + _target enableCollisionWith _x; + false + }; +}; + +_args set [3, _disabledCollisionObjects]; diff --git a/addons/dragging/functions/fnc_dragObjectPFH.sqf b/addons/dragging/functions/fnc_dragObjectPFH.sqf index 08aeba738b..11e740e73f 100644 --- a/addons/dragging/functions/fnc_dragObjectPFH.sqf +++ b/addons/dragging/functions/fnc_dragObjectPFH.sqf @@ -35,7 +35,7 @@ if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { if (!alive _target || {_unit distance _target > 10}) then { TRACE_2("dead/distance",_unit,_target); if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith { - //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime); }; diff --git a/addons/dragging/script_component.hpp b/addons/dragging/script_component.hpp index 7a82a9ed3a..89f704bc27 100644 --- a/addons/dragging/script_component.hpp +++ b/addons/dragging/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Dragging #include "\z\ace\addons\main\script_mod.hpp" -//#define DEBUG_ENABLED_DRAGGING +// #define DEBUG_ENABLED_DRAGGING // #define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS @@ -19,3 +19,5 @@ #define DRAG_ANIMATIONS ["amovpercmstpslowwrfldnon_acinpknlmwlkslowwrfldb_2", "amovpercmstpsraswpstdnon_acinpknlmwlksnonwpstdb_2", "amovpercmstpsnonwnondnon_acinpknlmwlksnonwnondb_2", "acinpknlmstpsraswrfldnon", "acinpknlmstpsnonwpstdnon", "acinpknlmstpsnonwnondnon", "acinpknlmwlksraswrfldb", "acinpknlmwlksnonwnondb"] #define CARRY_ANIMATIONS ["acinpercmstpsnonwnondnon", "acinpknlmstpsnonwnondnon_acinpercmrunsnonwnondnon"] + +#define DISABLE_COLLISION_DISTANCE 5 From 8bfcb5a1b175c743bdf1db66ce842928909fbcb3 Mon Sep 17 00:00:00 2001 From: jonpas Date: Fri, 28 Oct 2016 14:20:39 +0200 Subject: [PATCH 04/10] Reenable collision on drop, Update function headers --- addons/dragging/functions/fnc_carryObjectPFH.sqf | 5 +++-- addons/dragging/functions/fnc_dropObject_carry.sqf | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index c0b31dfa80..50d48a6da5 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -7,13 +7,14 @@ * 0: Unit * 1: Target * 2: Start time + * 3: Disabled Collision Objects (empty for in-PFH changes) * 1: PFEH Id * * Return Value: * None * * Example: - * [[player, target], 20] call ace_dragging_fnc_carryObjectPFH; + * [[player, target, []], 20] call ace_dragging_fnc_carryObjectPFH; * * Public: No */ @@ -39,7 +40,7 @@ if (!alive _target || {_unit distance _target > 10}) then { //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime); }; - [_unit, _target] call FUNC(dropObject_carry); + [_unit, _target, _disabledCollisionObjects] call FUNC(dropObject_carry); [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index c3521bbed0..6758d7086c 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -5,19 +5,20 @@ * Arguments: * 0: Unit that carries the other object * 1: Carried object to drop + * 2: Disabled Collision Objects * * Return Value: * None * * Example: - * [player, cursorTarget] call ace_dragging_fnc_dropObject_carry; + * [player, cursorTarget, [p1, p2]] call ace_dragging_fnc_dropObject_carry; * * Public: No */ #include "script_component.hpp" -params ["_unit", "_target"]; -TRACE_2("params",_unit,_target); +params ["_unit", "_target", "_disabledCollisionObjects"]; +TRACE_1("params",_this); // remove drop action [_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); @@ -75,3 +76,8 @@ if !(_target isKindOf "CAManBase") then { if (_target getVariable [QGVAR(isUAV), false]) then { createVehicleCrew _target; }; + +// Reenable collision with nearby objects +{ + _target enableCollisionWith _x; +} forEach _disabledCollisionObjects; From c08d15151e00f933a86d071f9c8be471f07ea915 Mon Sep 17 00:00:00 2001 From: jonpas Date: Sat, 29 Oct 2016 21:31:54 +0200 Subject: [PATCH 05/10] Fix error, Set disabled collision objects to object variable --- addons/dragging/functions/fnc_carryObject.sqf | 2 +- addons/dragging/functions/fnc_carryObjectPFH.sqf | 12 +++++++----- addons/dragging/functions/fnc_dropObject_carry.sqf | 5 ++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index e189cf242d..985f3ddab6 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -67,7 +67,7 @@ if (_target isKindOf "CAManBase") then { }; // check everything -[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime, []]] call CBA_fnc_addPerFrameHandler; +[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index 50d48a6da5..9cb12a45e8 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -7,14 +7,13 @@ * 0: Unit * 1: Target * 2: Start time - * 3: Disabled Collision Objects (empty for in-PFH changes) * 1: PFEH Id * * Return Value: * None * * Example: - * [[player, target, []], 20] call ace_dragging_fnc_carryObjectPFH; + * [[player, target], 20] call ace_dragging_fnc_carryObjectPFH; * * Public: No */ @@ -25,7 +24,7 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit","_target", "_startTime", "_disabledCollisionObjects"]; +_args params ["_unit","_target", "_startTime"]; if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { TRACE_2("carry false",_unit,_target); @@ -40,13 +39,15 @@ if (!alive _target || {_unit distance _target > 10}) then { //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime); }; - [_unit, _target, _disabledCollisionObjects] call FUNC(dropObject_carry); + [_unit, _target] call FUNC(dropObject_carry); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // Disable collision with nearby players +private _disabledCollisionObjects = _target getVariable [QGVAR(disabledCollisionObjects), []]; TRACE_1("Disable collision objects",_disabledCollisionObjects); + private _nearUnits = _target nearObjects ["CAManBase", DISABLE_COLLISION_DISTANCE]; { if !(_x in _disabledCollisionObjects) then { @@ -54,6 +55,7 @@ private _nearUnits = _target nearObjects ["CAManBase", DISABLE_COLLISION_DISTANC _target disableCollisionWith _x; _disabledCollisionObjects pushBack _x; }; + false } count _nearUnits; _disabledCollisionObjects = _disabledCollisionObjects select { @@ -66,4 +68,4 @@ _disabledCollisionObjects = _disabledCollisionObjects select { }; }; -_args set [3, _disabledCollisionObjects]; +_target setVariable [QGVAR(disabledCollisionObjects), _disabledCollisionObjects]; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 6758d7086c..d218ad4fbd 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -5,7 +5,6 @@ * Arguments: * 0: Unit that carries the other object * 1: Carried object to drop - * 2: Disabled Collision Objects * * Return Value: * None @@ -17,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_target", "_disabledCollisionObjects"]; +params ["_unit", "_target"]; TRACE_1("params",_this); // remove drop action @@ -80,4 +79,4 @@ if (_target getVariable [QGVAR(isUAV), false]) then { // Reenable collision with nearby objects { _target enableCollisionWith _x; -} forEach _disabledCollisionObjects; +} forEach (_target getVariable [QGVAR(disabledCollisionObjects), []]); From 7c4a7c2328718d7ef5cd13ddf699b5ae9fea69aa Mon Sep 17 00:00:00 2001 From: jonpas Date: Sat, 29 Oct 2016 21:32:49 +0200 Subject: [PATCH 06/10] Fix header --- addons/dragging/functions/fnc_dropObject_carry.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index d218ad4fbd..4a1a77aa45 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [player, cursorTarget, [p1, p2]] call ace_dragging_fnc_dropObject_carry; + * [player, cursorTarget] call ace_dragging_fnc_dropObject_carry; * * Public: No */ From 07ebb83281bf8d83adca0e31a2949746d8914bb9 Mon Sep 17 00:00:00 2001 From: jonpas Date: Sat, 29 Oct 2016 21:37:50 +0200 Subject: [PATCH 07/10] Fix PlasticCase drag direction --- addons/dragging/CfgVehicles.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index bc0372285a..9a092458fe 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -128,7 +128,7 @@ class CfgVehicles { GVAR(canDrag) = 1; GVAR(dragPosition[]) = {0,1.2,0}; - GVAR(dragDirection) = 0; + GVAR(dragDirection) = 270; }; class MetalCase_01_base_F: Items_base_F { class EventHandlers { From 6ac2906aba0154248ad03fc05cded5b0a5eb7c14 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 24 Mar 2019 09:26:00 +0100 Subject: [PATCH 08/10] setMass method to disable collisions --- addons/common/XEH_postInit.sqf | 5 +++ .../dragging/functions/fnc_carryObjectPFH.sqf | 33 ++----------------- addons/dragging/functions/fnc_dropObject.sqf | 7 ++++ .../functions/fnc_dropObject_carry.sqf | 10 +++--- addons/dragging/functions/fnc_startCarry.sqf | 8 +++++ addons/dragging/functions/fnc_startDrag.sqf | 8 +++++ addons/dragging/script_component.hpp | 2 -- 7 files changed, 37 insertions(+), 36 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 2ced174f30..eb626a923b 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -83,6 +83,11 @@ _vehicle engineOn false; }] call CBA_fnc_addEventHandler; +[QGVAR(setMass), { + params ["_object", "_mass"]; + _object setMass _mass; +}] call CBA_fnc_addEventHandler; + //Add a fix for BIS's zeus remoteControl module not reseting variables on DC when RC a unit //This variable is used for isPlayer checks if (isServer) then { diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index f1491921fd..6204bbae62 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* - * Author: commy2, Jonpas + * Author: commy2 * PFH for Carry Object * * Arguments: @@ -24,7 +24,7 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit","_target", "_startTime"]; +_args params ["_unit", "_target", "_startTime"]; if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { TRACE_2("carry false",_unit,_target); @@ -35,37 +35,10 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { if (!alive _target || {_unit distance _target > 10}) then { TRACE_2("dead/distance",_unit,_target); if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith { - //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //attachTo seems to have some kind of network delay and target can return an odd position during the first few frames, //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime); }; [_unit, _target] call FUNC(dropObject_carry); [_idPFH] call CBA_fnc_removePerFrameHandler; }; - - -// Disable collision with nearby players -private _disabledCollisionObjects = _target getVariable [QGVAR(disabledCollisionObjects), []]; -TRACE_1("Disable collision objects",_disabledCollisionObjects); - -private _nearUnits = _target nearObjects ["CAManBase", DISABLE_COLLISION_DISTANCE]; -{ - if !(_x in _disabledCollisionObjects) then { - TRACE_2("Adding disable collision object",_x,typeOf _x); - _target disableCollisionWith _x; - _disabledCollisionObjects pushBack _x; - }; - false -} count _nearUnits; - -_disabledCollisionObjects = _disabledCollisionObjects select { - if (_x in _nearUnits) then { - true - } else { - TRACE_2("Removing disable collision object",_x,typeOf _x); - _target enableCollisionWith _x; - false - }; -}; - -_target setVariable [QGVAR(disabledCollisionObjects), _disabledCollisionObjects]; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index fde2a7f6d7..9472acbaa5 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -76,3 +76,10 @@ if (_unit getVariable ["ACE_isUnconscious", false]) then { if (_target getVariable [QGVAR(isUAV), false]) then { createVehicleCrew _target; }; + +// reset mass +private _mass = _target getVariable [QGVAR(originalMass), 0]; + +if (_mass != 0) then { + [QEGVAR(setMass), [_target, _mass], _target] call CBA_fnc_targetEvent; +}; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index c9b1c5bbd5..9e521d0926 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -77,7 +77,9 @@ if (_target getVariable [QGVAR(isUAV), false]) then { createVehicleCrew _target; }; -// Reenable collision with nearby objects -{ - _target enableCollisionWith _x; -} forEach (_target getVariable [QGVAR(disabledCollisionObjects), []]); +// reset mass +private _mass = _target getVariable [QGVAR(originalMass), 0]; + +if (_mass != 0) then { + [QEGVAR(setMass), [_target, _mass], _target] call CBA_fnc_targetEvent; +}; diff --git a/addons/dragging/functions/fnc_startCarry.sqf b/addons/dragging/functions/fnc_startCarry.sqf index 0366879d2b..5e65013bb9 100644 --- a/addons/dragging/functions/fnc_startCarry.sqf +++ b/addons/dragging/functions/fnc_startCarry.sqf @@ -73,3 +73,11 @@ _unit setVariable [QGVAR(isCarrying), true, true]; _unit setVariable [QGVAR(carriedObject), _target, true]; [FUNC(startCarryPFH), 0.2, [_unit, _target, _timer]] call CBA_fnc_addPerFrameHandler; + +// disable collisions by setting the physx mass to almost zero +private _mass = getMass _target; + +if (_mass > 1) then { + _target setVariable [QGVAR(originalMass), _mass, true]; + [QEGVAR(setMass), [_target, 1e-12], _target] call CBA_fnc_targetEvent; +}; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index da8a99edf3..3879de01a3 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -61,3 +61,11 @@ if (_target isKindOf "CAManBase") then { _unit setVariable [QGVAR(isDragging), true, true]; [FUNC(startDragPFH), 0.2, [_unit, _target, CBA_missionTime + 5]] call CBA_fnc_addPerFrameHandler; + +// disable collisions by setting the physx mass to almost zero +private _mass = getMass _target; + +if (_mass > 1) then { + _target setVariable [QGVAR(originalMass), _mass, true]; + [QEGVAR(setMass), [_target, 1e-12], _target] call CBA_fnc_targetEvent; +}; diff --git a/addons/dragging/script_component.hpp b/addons/dragging/script_component.hpp index 89f704bc27..01b466972f 100644 --- a/addons/dragging/script_component.hpp +++ b/addons/dragging/script_component.hpp @@ -19,5 +19,3 @@ #define DRAG_ANIMATIONS ["amovpercmstpslowwrfldnon_acinpknlmwlkslowwrfldb_2", "amovpercmstpsraswpstdnon_acinpknlmwlksnonwpstdb_2", "amovpercmstpsnonwnondnon_acinpknlmwlksnonwnondb_2", "acinpknlmstpsraswrfldnon", "acinpknlmstpsnonwpstdnon", "acinpknlmstpsnonwnondnon", "acinpknlmwlksraswrfldb", "acinpknlmwlksnonwnondb"] #define CARRY_ANIMATIONS ["acinpercmstpsnonwnondnon", "acinpknlmstpsnonwnondnon_acinpercmrunsnonwnondnon"] - -#define DISABLE_COLLISION_DISTANCE 5 From 6cff8deba8be0088216dbc3c9120003c8c6bd4b5 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 24 Mar 2019 09:28:58 +0100 Subject: [PATCH 09/10] cleanup dragging --- addons/dragging/functions/fnc_dragObjectPFH.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/dragging/functions/fnc_dragObjectPFH.sqf b/addons/dragging/functions/fnc_dragObjectPFH.sqf index 2e559f82bd..a45a26ae89 100644 --- a/addons/dragging/functions/fnc_dragObjectPFH.sqf +++ b/addons/dragging/functions/fnc_dragObjectPFH.sqf @@ -24,7 +24,7 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit","_target", "_startTime"]; +_args params ["_unit", "_target", "_startTime"]; if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { TRACE_2("drag false",_unit,_target); @@ -35,7 +35,7 @@ if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { if (!alive _target || {_unit distance _target > 10}) then { TRACE_2("dead/distance",_unit,_target); if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith { - //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //attachTo seems to have some kind of network delay and target can return an odd position during the first few frames, //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime); }; From 5277bc083bac721bb12ecce929eb758e7d699d46 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 24 Mar 2019 09:41:36 +0100 Subject: [PATCH 10/10] fix a macro --- addons/dragging/functions/fnc_dropObject.sqf | 2 +- addons/dragging/functions/fnc_dropObject_carry.sqf | 2 +- addons/dragging/functions/fnc_startCarry.sqf | 2 +- addons/dragging/functions/fnc_startDrag.sqf | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 9472acbaa5..84bbd90342 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -81,5 +81,5 @@ if (_target getVariable [QGVAR(isUAV), false]) then { private _mass = _target getVariable [QGVAR(originalMass), 0]; if (_mass != 0) then { - [QEGVAR(setMass), [_target, _mass], _target] call CBA_fnc_targetEvent; + [QEGVAR(common,setMass), [_target, _mass], _target] call CBA_fnc_targetEvent; }; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 9e521d0926..b6507898ca 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -81,5 +81,5 @@ if (_target getVariable [QGVAR(isUAV), false]) then { private _mass = _target getVariable [QGVAR(originalMass), 0]; if (_mass != 0) then { - [QEGVAR(setMass), [_target, _mass], _target] call CBA_fnc_targetEvent; + [QEGVAR(common,setMass), [_target, _mass], _target] call CBA_fnc_targetEvent; }; diff --git a/addons/dragging/functions/fnc_startCarry.sqf b/addons/dragging/functions/fnc_startCarry.sqf index 5e65013bb9..729fec2a4e 100644 --- a/addons/dragging/functions/fnc_startCarry.sqf +++ b/addons/dragging/functions/fnc_startCarry.sqf @@ -79,5 +79,5 @@ private _mass = getMass _target; if (_mass > 1) then { _target setVariable [QGVAR(originalMass), _mass, true]; - [QEGVAR(setMass), [_target, 1e-12], _target] call CBA_fnc_targetEvent; + [QEGVAR(common,setMass), [_target, 1e-12], _target] call CBA_fnc_targetEvent; }; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index 3879de01a3..7a4c8908d3 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -67,5 +67,5 @@ private _mass = getMass _target; if (_mass > 1) then { _target setVariable [QGVAR(originalMass), _mass, true]; - [QEGVAR(setMass), [_target, 1e-12], _target] call CBA_fnc_targetEvent; + [QEGVAR(common,setMass), [_target, 1e-12], _target] call CBA_fnc_targetEvent; };