Use ghost object instead of nearestObject
This commit is contained in:
vbawol 2017-07-28 08:02:29 -05:00 committed by GitHub
commit a829f00443

View File

@ -23,7 +23,7 @@
NOTHING NOTHING
*/ */
//[[[cog import generate_private_arrays ]]] //[[[cog import generate_private_arrays ]]]
private ["_AnchorPos","_EPOCH_1","_EPOCH_2","_MoveObject","_Snapdirection","_allowedSnapObjects","_allowedSnapPoints","_arr_snapPoints","_baselineSnapPos","_cfgBaseBuilding","_class","_currentOffSet","_currentPos","_currentTarget","_currentTargetAttachedTo","_dir2","_direction","_distance","_energyCost","_helper","_ins","_isSnap","_lastCheckTime","_maxHeight","_maxSnapDistance","_nearestObject","_nearestObjects","_newDirAndUp","_numberOfContacts","_objSlot","_objType","_offSet","_offsetZPos","_pOffset","_pos1_snap","_pos2","_pos2ATL","_pos2_snap","_pos_snapObj","_rejectMove","_simulClass","_snapChecks","_snapConfig","_snapDistance","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPos1","_snapPosition","_snapType","_snapped","_stabilityCheck","_worldspace"]; private ["_AnchorPos","_EPOCH_1","_EPOCH_2","_MoveObject","_Snapdirection","_allowedSnapObjects","_allowedSnapPoints","_arr_snapPoints","_baselineSnapPos","_cfgBaseBuilding","_class","_currentOffSet","_currentPos","_currentTarget","_currentTargetAttachedTo","_dir2","_direction","_distance","_energyCost","_helper","_ins","_isSnap","_lastCheckTime","_maxHeight","_maxSnapDistance","_nearestObject","_nearestObjects","_newDirAndUp","_numberOfContacts","_objSlot","_objType","_offSet","_offsetZPos","_pOffset","_pos1_snap","_pos2","_pos2ATL","_pos2_snap","_pos_snapObj","_rejectMove","_simulClass","_snapChecks","_snapConfig","_snapDistance","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPos1","_snapPosition","_snapType","_snapped","_stabilityCheck","_worldspace","_snapMemoryPoint","_vectorDir","_vectorUp","_tempClass","_newDir"];
//[[[end]]] //[[[end]]]
if !(isNil "EPOCH_simulSwap_Lock") exitWith{}; if !(isNil "EPOCH_simulSwap_Lock") exitWith{};
@ -110,6 +110,7 @@ if (_class != "") then {
EPOCH_buildDirectionRoll = 0; EPOCH_buildDirectionRoll = 0;
EPOCH_target_attachedTo = player; EPOCH_target_attachedTo = player;
EP_snap = objNull; EP_snap = objNull;
EPOCH_tempTarget = objNull;
EP_snapPos = [0, 0, 0]; EP_snapPos = [0, 0, 0];
_isSnap = false; _isSnap = false;
_currentOffSet = []; _currentOffSet = [];
@ -293,18 +294,25 @@ if (_class != "") then {
if(!(_vectorUp select 0 == 0) || !(_vectorUp select 1 == 0) || !( _vectorUp select 2 == 1)) then{ if(!(_vectorUp select 0 == 0) || !(_vectorUp select 1 == 0) || !( _vectorUp select 2 == 1)) then{
if(_snapType isEqualTo "perp")then{ if(_snapType isEqualTo "perp")then{
if(_snapMemoryPoint in ["W","E"])then{ if(_snapMemoryPoint in ["W","E"])then{
_nearestObject setDir ((getDir _nearestObject) + (EPOCH_snapDirection * 90)); _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));
_newDir = vectorDir EPOCH_tempTarget;
_vectorDir = _newDir;
}; };
}; };
_newDir = vectorDir _nearestObject;
_nearestObject setVectorDirAndUp [_vectorDir,_vectorUp];
_vectorDir = _newDir;
_currentTarget setposATL _snapPosition; _currentTarget setposATL _snapPosition;
_currentTarget setDir ((getDir _currentTarget) + (EPOCH_snapDirection * 90)); _currentTarget setDir ((getDir _currentTarget) + (EPOCH_snapDirection * 90));
_currentTarget setVectorDirAndUp [_vectorDir,_vectorUP]; _currentTarget setVectorDirAndUp [_vectorDir,_vectorUP];
}; };
_snapped = true; _snapped = true;
if(!isNil "EPOCH_tempTarget")then{
deleteVehicle EPOCH_tempTarget;
EPOCH_tempTarget = objNull;
};
_arr_snapPoints = []; _arr_snapPoints = [];
EPOCH_arr_snapPoints = []; EPOCH_arr_snapPoints = [];
{ {