Skip to content

Commit d95e472

Browse files
deBearNDartRuffianPabstMirror
authored
Explosives - Taking bounding box into consideration when attaching (#11335)
* Taking B-box into consideration for explosives * Apply suggestion from @DartRuffian Co-authored-by: Dart <59131299+DartRuffian@users.noreply.github.com> * Apply suggestion from @DartRuffian Co-authored-by: Dart <59131299+DartRuffian@users.noreply.github.com> * Apply suggestion from @DartRuffian Co-authored-by: Dart <59131299+DartRuffian@users.noreply.github.com> * Apply suggestion from @PabstMirror Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Apply suggestion from @PabstMirror Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Update addons/explosives/functions/fnc_setupExplosive.sqf * Apply suggestion from @PabstMirror --------- Co-authored-by: Dart <59131299+DartRuffian@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
1 parent f3afe17 commit d95e472

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

addons/explosives/functions/fnc_setupExplosive.sqf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,21 @@ GVAR(TweakedAngle) = 0;
200200
if (GVAR(placeAction) == PLACE_APPROVE) then {
201201
private _placeAngle = 0;
202202
private _expSetupVehicle = _setupObjectClass createVehicle [0, 0, 0]; //(_virtualPosASL call EFUNC(common,ASLToPosition));
203+
// Running it AGAIN in here because it needs the _expSetupVehicle Object for the boundingBox
204+
private _intersect = lineIntersectsSurfaces [
205+
eyePos _unit,
206+
_basePosASL vectorAdd (_lookDirVector vectorMultiply PLACE_RANGE_MAX),
207+
_unit, _expSetupVehicle, true, 1, "FIRE", "GEOM"
208+
] param [0, []];
209+
_virtualPosASL = if (_intersect isNotEqualTo []) then {
210+
_intersect params ["_posASL", "_normal"];
211+
212+
private _bbox = boundingBoxReal [_expSetupVehicle, "FireGeometry"];
213+
private _offset = -((_bbox select 0) select 2);
214+
_posASL vectorAdd (_normal vectorMultiply _offset);
215+
} else {
216+
_basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase);
217+
};
203218

204219
TRACE_1("Planting Mass",getMass _expSetupVehicle);
205220

0 commit comments

Comments
 (0)