From 53e0e45b08ee47eeec6a38d81740dc648121c99e Mon Sep 17 00:00:00 2001 From: "DESKTOP-UH65DCE\\MusTanG" Date: Mon, 4 Sep 2017 11:19:29 -0500 Subject: [PATCH] Snap Wall 2 Wall Wall 2 Wall Snapping with rotation fixes. Move around code for use in both para and perp snapping --- .../compile/building/EPOCH_staticMove.sqf | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf b/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf index b5a05fcc..12cfc593 100644 --- a/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_staticMove.sqf @@ -292,23 +292,32 @@ if (_class != "") then { // Vector + Snapping if(!(_vectorUp select 0 == 0) || !(_vectorUp select 1 == 0) || !(_vectorUp select 2 == 1)) then{ + _tiltFB = (((_vectorUp select 0 < 0) && (_vectorUp select 1 > 0)) || ((_vectorUp select 0 > 0) && (_vectorUp select 1 < 0))); + _tiltLR = (((_vectorUp select 0 > 0) && (_vectorUp select 1 > 0)) || ((_vectorUp select 0 < 0) && (_vectorUp select 1 < 0))); + _tempClass = getText(_cfgBaseBuilding >> (typeOf _nearestObject) >> "GhostPreview"); + EPOCH_tempTarget = _tempClass createVehicleLocal [0,0,0]; + EPOCH_tempTarget setPosATL (getPosATL _nearestObject); + EPOCH_tempTarget setVectorDirAndUp [_vectorDir, _vectorUp]; + EPOCH_tempTarget setDir ((getDir _nearestObject) + (EPOCH_snapDirection * 90)); if(_snapType isEqualTo "perp")then{ - _tempClass = getText(_cfgBaseBuilding >> (typeOf _nearestObject) >> "GhostPreview"); - EPOCH_tempTarget = _tempClass createVehicleLocal [0,0,0]; - EPOCH_tempTarget setPosATL (getPosATL _nearestObject); - EPOCH_tempTarget setVectorDirAndUp [_vectorDir, _vectorUp]; - EPOCH_tempTarget setDir ((getDir _nearestObject) + (EPOCH_snapDirection * 90)); - _tiltFB = (((_vectorUp select 0 < 0) && (_vectorUp select 1 > 0)) || ((_vectorUp select 0 > 0) && (_vectorUp select 1 < 0))); - _tiltLR = (((_vectorUp select 0 > 0) && (_vectorUp select 1 > 0)) || ((_vectorUp select 0 < 0) && (_vectorUp select 1 < 0))); if( ((_tiltFB) && (_snapMemoryPoint in ["W","E"]) && (EPOCH_snapDirection in [0,2])) || ((_tiltLR) && (_snapMemoryPoint in ["N","S"]) && (EPOCH_snapDirection in [1,3])))then{ EPOCH_tempTarget setVectorUp _vectorUp; }; if( ((_tiltFB) && (_snapMemoryPoint in ["N","S"])) || ((_tiltLR) && (_snapMemoryPoint in ["W","E"])) )then{ EPOCH_tempTarget setVectorUp _vectorUp; - }; - _newDir = vectorDir EPOCH_tempTarget; - _vectorDir = _newDir; + }; }; + if(_snapType isEqualTo "para")then{ + if((_tiltFB) && (EPOCH_snapDirection in [0,2]))then{ + EPOCH_tempTarget setVectorUp _vectorUp; + }; + if((_tiltLR) && (EPOCH_snapDirection in [1,3]))then{ + EPOCH_tempTarget setVectorUp _vectorUp; + }; + }; + _newDir = vectorDir EPOCH_tempTarget; + _vectorDir = _newDir; + _currentTarget setposATL _snapPosition; _currentTarget setDir ((getDir _currentTarget) + (EPOCH_snapDirection * 90)); _currentTarget setVectorDirAndUp [_vectorDir,_vectorUP];