mirror of
https://github.com/sethduda/AdvancedSlingLoading.git
synced 2024-08-30 17:32:12 +00:00
Adding array to define class-specific sling load height offsets
This commit is contained in:
parent
a0977d086e
commit
d92fc828d4
@ -28,9 +28,18 @@ ASL_Rope_Get_Lift_Capability = {
|
|||||||
_slingLoadMaxCargoMass;
|
_slingLoadMaxCargoMass;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Defines number of meters to move the sling load point up/down
|
||||||
|
// from the dynamically calculated sling load position. This is needed
|
||||||
|
// because the dynamic sling load position sometimes is slightly inside
|
||||||
|
// the helicopter, causing damage to the vehicle.
|
||||||
|
|
||||||
|
ASL_SLING_LOAD_POINT_CLASS_HEIGHT_OFFSET = [
|
||||||
|
["All", [-0.2, -0.2, -0.2]]
|
||||||
|
];
|
||||||
|
|
||||||
ASL_Get_Sling_Load_Points = {
|
ASL_Get_Sling_Load_Points = {
|
||||||
params ["_vehicle"];
|
params ["_vehicle"];
|
||||||
private ["_slingLoadPointsArray","_cornerPoints","_rearCenterPoint","_vehicleUnitVectorUp"];
|
private ["_slingLoadPointsArray","_cornerPoints","_rearCenterPoint","_vehicleUnitVectorUp","_slingLoadPointHeightOffset"];
|
||||||
private ["_slingLoadPoints","_modelPoint","_modelPointASL","_surfaceIntersectStartASL","_surfaceIntersectEndASL","_surfaces","_intersectionASL","_intersectionObject"];
|
private ["_slingLoadPoints","_modelPoint","_modelPointASL","_surfaceIntersectStartASL","_surfaceIntersectEndASL","_surfaces","_intersectionASL","_intersectionObject"];
|
||||||
_slingLoadPointsArray = [];
|
_slingLoadPointsArray = [];
|
||||||
_cornerPoints = [_vehicle] call ASL_Get_Corner_Points;
|
_cornerPoints = [_vehicle] call ASL_Get_Corner_Points;
|
||||||
@ -41,6 +50,13 @@ ASL_Get_Sling_Load_Points = {
|
|||||||
_middleCenterPoint = ((_frontCenterPoint vectorDiff _rearCenterPoint) vectorMultiply 0.5) vectorAdd _rearCenterPoint;
|
_middleCenterPoint = ((_frontCenterPoint vectorDiff _rearCenterPoint) vectorMultiply 0.5) vectorAdd _rearCenterPoint;
|
||||||
_vehicleUnitVectorUp = vectorNormalized (vectorUp _vehicle);
|
_vehicleUnitVectorUp = vectorNormalized (vectorUp _vehicle);
|
||||||
|
|
||||||
|
_slingLoadPointHeightOffset = 0;
|
||||||
|
{
|
||||||
|
if(_vehicle isKindOf (_x select 0)) then {
|
||||||
|
_slingLoadPointHeightOffset = (_x select 1);
|
||||||
|
};
|
||||||
|
} forEach ASL_SLING_LOAD_POINT_CLASS_HEIGHT_OFFSET;
|
||||||
|
|
||||||
_slingLoadPoints = [];
|
_slingLoadPoints = [];
|
||||||
{
|
{
|
||||||
_modelPoint = _x;
|
_modelPoint = _x;
|
||||||
@ -56,7 +72,7 @@ ASL_Get_Sling_Load_Points = {
|
|||||||
};
|
};
|
||||||
} forEach _surfaces;
|
} forEach _surfaces;
|
||||||
if(count _intersectionASL > 0) then {
|
if(count _intersectionASL > 0) then {
|
||||||
_intersectionASL = _intersectionASL vectorAdd (( _surfaceIntersectStartASL vectorFromTo _surfaceIntersectEndASL ) vectorMultiply 0.2);
|
_intersectionASL = _intersectionASL vectorAdd (( _surfaceIntersectStartASL vectorFromTo _surfaceIntersectEndASL ) vectorMultiply (-1 * (_slingLoadPointHeightOffset select (count _slingLoadPoints))));
|
||||||
_slingLoadPoints pushBack (_vehicle worldToModelVisual (ASLToAGL _intersectionASL));
|
_slingLoadPoints pushBack (_vehicle worldToModelVisual (ASLToAGL _intersectionASL));
|
||||||
} else {
|
} else {
|
||||||
_slingLoadPoints pushBack [];
|
_slingLoadPoints pushBack [];
|
||||||
@ -1174,4 +1190,4 @@ diag_log "Advanced Sling Loading Loaded";
|
|||||||
|
|
||||||
if(isServer) then {
|
if(isServer) then {
|
||||||
[] call ASL_Advanced_Sling_Loading_Install;
|
[] call ASL_Advanced_Sling_Loading_Install;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user