Fixed an issue with fragments being created above water for explosions below the surface

This commit is contained in:
lambdatiger 2024-05-19 00:14:14 -05:00
parent e2dce5e102
commit b9aa3cb65b
2 changed files with 4 additions and 3 deletions

View File

@ -41,7 +41,7 @@ _maxFragCount = switch (true) do {
};
// Spawn the fragment spawner
private _fragSpawner = createVehicle [_type + _maxFragCount + _hMode, ASLToATL _posASL, [], 0, "CAN_COLLIDE"];
private _fragSpawner = createVehicle [_type + _maxFragCount + _hMode, ASLToAGL _posASL, [], 0, "CAN_COLLIDE"];
private _randDir = random 360;
_fragSpawner setVectorDirandUp [[0,0,-1], [cos _randDir, sin _randDir,0]];
_fragSpawner setVelocity (_projectileVelocity vectorAdd [0, 0, -0.5*_fragVelocity]);

View File

@ -38,9 +38,10 @@ if (_fragTypes isEqualTo []) then {
];
};
private _posAGL = ASLToAGL _posASL;
// Post 2.18 change - uncomment line 41, and remove lines 43, 50-55, 64-66
// private _targets = [ASLToAGL _posASL, _fragRange, _fragRange, 0, false, _fragRange] nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], false, true, true];
private _objects = (ASLToAGL _posASL) nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange];
private _objects = _posAGL nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange];
if (_objects isEqualTo []) exitWith {
TRACE_2("No nearby targets",_posASL,_fragRange);
0
@ -152,7 +153,7 @@ private _totalFragCount = 0;
// Create fragment
private _vectorDir = _posASL vectorFromTo _targetPos;
private _fragObj = createVehicle [_fragSpawner, ASLtoATL _posASL, [], 0, "CAN_COLLIDE"];
private _fragObj = createVehicle [_fragSpawner, _posAGL, [], 0, "CAN_COLLIDE"];
_fragObj setVectorDir _vectorDir;
_fragObj setVelocity (_vectorDir vectorMultiply _locFragVel);
_fragObj setShotParents _shotParents;