mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
prevent casings from sinking below the terrain
This commit is contained in:
parent
dababe84b9
commit
dac399963e
@ -48,7 +48,7 @@ if (isNil "_modelPath") then {
|
||||
|
||||
if (_modelPath isEqualTo "") exitWith {};
|
||||
|
||||
private _unitPos = getposASL _unit;
|
||||
private _unitPos = getPosASL _unit;
|
||||
// Distant shooters don't produce as many cases
|
||||
if ((AGLToASL positionCameraToWorld [0,0,0]) vectorDistance _unitPos > 100 && {random 1 < 0.9}) exitWith {};
|
||||
|
||||
@ -60,10 +60,14 @@ private _pos = _unitPos
|
||||
|
||||
[
|
||||
{
|
||||
params ["_modelPath", "_pos"];
|
||||
params ["_modelPath", "_pos", "_unitPos"];
|
||||
|
||||
private _lisPos = (lineIntersectsSurfaces [_pos, _pos vectorAdd [0,0,-1e11], objNull, objNull, true, 1, "ROADWAY", "FIRE"]) #0;
|
||||
private _casing = createSimpleObject [_modelPath, (_lisPos #0 vectorAdd [0,0,0.005]), true];
|
||||
private _lisPos = (lineIntersectsSurfaces [_pos, _pos vectorAdd [0,0,-1e11], objNull, objNull, true, 1, "ROADWAY", "FIRE"]) select 0;
|
||||
private _casingPos = (_lisPos select 0) vectorAdd [0,0,0.005];
|
||||
if (((ASLtoATL _casingPos) select 2) < 0) then { // prevent casings sinking into the terrain
|
||||
_casingPos set [2, _unitPos select 2];
|
||||
};
|
||||
private _casing = createSimpleObject [_modelPath, _casingPos, true];
|
||||
_casing setDir (random 360);
|
||||
_casing setVectorUp _lisPos #1;
|
||||
private _idx = GVAR(casings) pushBack _casing;
|
||||
@ -72,6 +76,6 @@ private _pos = _unitPos
|
||||
deleteVehicle (GVAR(casings) deleteAt 0);
|
||||
};
|
||||
},
|
||||
[_modelPath,_pos],
|
||||
0.4
|
||||
[_modelPath, _pos, _unitPos],
|
||||
0.1
|
||||
] call CBA_fnc_waitAndExecute;
|
||||
|
Loading…
Reference in New Issue
Block a user