From 15bc5f1318a2089857f7887259cea4cccf9d7eb2 Mon Sep 17 00:00:00 2001 From: sethduda Date: Wed, 3 Feb 2016 17:06:26 -0500 Subject: [PATCH] Updating mount points to be centered on object's center of mass --- addons/SA_AdvancedSlingLoading.pbo | Bin 18461 -> 19154 bytes ...ingLoading.pbo.AdvancedSlingLoading.bisign | Bin 0 -> 573 bytes .../functions/fn_advancedSlingLoadingInit.sqf | 24 ++++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 addons/SA_AdvancedSlingLoading.pbo.AdvancedSlingLoading.bisign diff --git a/addons/SA_AdvancedSlingLoading.pbo b/addons/SA_AdvancedSlingLoading.pbo index 2fdbae74d199d867f52280cb71e5f4b31309a179..f0bc075d8f2d146797ec24119a079cad4f04b453 100644 GIT binary patch delta 1021 zcmbO`f$`E*#tA-5y5$r7Y}gXZHifl#Oq?jbad|T%o2j9NiKX#o1Ew7cI=oz*oSgB= zsd*)-MgD2NiN(bVwhHN~CC2k^s6^uaIz=kQHx&&sdf~KYd zP#MUmdZ258T76RU(y_b25Zw)inlLxyfHk2x0%{VnE3i7k5aNh>uqz;r@JP)}&j5J` zBOt&&LJkNcxFa&an&6HAc?M#Rz8NH_z~L1Q4RRfYXblwSQxUGmZZt5yiFSi7xo(IBhQZ`3Dyoyy@wo$N wJaJ(`xjQyc#T{hF2{b(PHvd)OQ5JDLtCK2}^LnrQZ>dMlPgmMbRx7y&01A~(#sB~S delta 299 zcmcaKm2vI_#tA-5@3<%W*|6Q`-V}D;b>c+vjmw)E*-R`A4U8=|8!+uqm@KXwRbOGK zV5^`JUtp+EoSKuGT%us0Y0b;U$;laCi7sOZlc_?NF@nid7(q-k!ZZzC24Wfy(4s1s z)Z|xc(!B8%hWbW2K-+<&!Q=*Y&B-mQ!az|YG*N3cgeXW3qV^M56k-BQ)M)c|b#`SD Zdv47G7o>xkpL@KXmZqz?dRyK4Yyf-?RbT)B diff --git a/addons/SA_AdvancedSlingLoading.pbo.AdvancedSlingLoading.bisign b/addons/SA_AdvancedSlingLoading.pbo.AdvancedSlingLoading.bisign new file mode 100644 index 0000000000000000000000000000000000000000..7c1cdc5c17e74521ec4300d45702c6a8beca8060 GIT binary patch literal 573 zcmV-D0>b@4WOiY0V`XGhY-w(1OmAUiX>Ml#lmGw#1_A&803-kaQd2=O00aO40RRC2 z{pPNXp<0#kV5;$I2TB3>y^YmEDI1K3+x%&c$R5 zw-a9<@%QY&c3NcQls&Z2?WeKZEzyN^L)x#%!h3(eu8ia*GSN0OqBl1|?av8zoI zSbV2v4!+EUyHx4?$W#~AG967CdebdtB;Ax7Kf*5R7jG%GV&8lhzb$v7k6)7&4Fh|e z+TS}mOEME!?Ccv)?!D5tp3bbTIMs74&F7V%RpnZBfB*mh*E(rBGcTmRb3E*46_n~5 z-@iZ(zhkNY0nT*;tuTZV1Ik8A4;4CoqPWY~*j z$?>H|(r)w8xKyAQJ}Tr6PTLoooDXyOsj?adzo%r%DNoG1t39P}#zc7{NdI`C$?D!q L#<@7ZTWLmn literal 0 HcmV?d00001 diff --git a/addons/SA_AdvancedSlingLoading/functions/fn_advancedSlingLoadingInit.sqf b/addons/SA_AdvancedSlingLoading/functions/fn_advancedSlingLoadingInit.sqf index cb0fc63..542dcca 100644 --- a/addons/SA_AdvancedSlingLoading/functions/fn_advancedSlingLoadingInit.sqf +++ b/addons/SA_AdvancedSlingLoading/functions/fn_advancedSlingLoadingInit.sqf @@ -179,19 +179,23 @@ SA_Rope_Attach_Cargo_Ropes = { [{ hint "The ropes are too short. Extend them." },"BIS_fnc_spawn",_player] call BIS_fnc_MP; } else { [_heli,_player] call SA_Rope_Drop_Cargo_Ropes; + + _centerOfMass = getCenterOfMass _target; _bbr = boundingBoxReal _target; _p1 = _bbr select 0; _p2 = _bbr select 1; - _x1 = (_p1 select 0); - _y1 = (_p1 select 1); - _z1 = (_p1 select 2); - _x2 = (_p2 select 0); - _y2 = (_p2 select 1); - _z2 = (_p2 select 2); - [_target, [_x1/2,_y1/2,0], [0,0,-1]] ropeAttachTo (_ropes select 0); - [_target, [_x2/2,_y1/2,0], [0,0,-1]] ropeAttachTo (_ropes select 1); - [_target, [_x2/2,_y2/2,0], [0,0,-1]] ropeAttachTo (_ropes select 2); - [_target, [_x1/2,_y2/2,0], [0,0,-1]] ropeAttachTo (_ropes select 3); + _maxWidth = abs ((_p2 select 0) - (_p1 select 0)); + _widthOffset = ((_maxWidth / 2) - abs ( _centerOfMass select 0 )) / 2; + _maxLength = abs ((_p2 select 1) - (_p1 select 1)); + _lengthOffset = ((_maxLength / 2) - abs (_centerOfMass select 1 )) / 2; + _maxHeight = abs ((_p2 select 2) - (_p1 select 2)); + _heightOffset = _maxHeight/6; + + [_target, [(_centerOfMass select 0) + _widthOffset, (_centerOfMass select 1) + _lengthOffset, (_centerOfMass select 2) + _heightOffset], [0,0,-1]] ropeAttachTo (_ropes select 0); + [_target, [(_centerOfMass select 0) + _widthOffset, (_centerOfMass select 1) - _lengthOffset, (_centerOfMass select 2) + _heightOffset], [0,0,-1]] ropeAttachTo (_ropes select 1); + [_target, [(_centerOfMass select 0) - _widthOffset, (_centerOfMass select 1) - _lengthOffset, (_centerOfMass select 2) + _heightOffset], [0,0,-1]] ropeAttachTo (_ropes select 2); + [_target, [(_centerOfMass select 0) - _widthOffset, (_centerOfMass select 1) + _lengthOffset, (_centerOfMass select 2) + _heightOffset], [0,0,-1]] ropeAttachTo (_ropes select 3); + [_target, _heli, _ropes] spawn SA_Rope_Adjust_Mass; }; };