@@ -65,7 +65,7 @@ SA_Simulate_Towing_Speed = {
6565
6666 _maxVehicleSpeed = getNumber (configFile >> " CfgVehicles" >> typeOf _vehicle >> " maxSpeed" );
6767 _vehicleMass = 1000 max (getMass _vehicle );
68- _maxTowedCargo = missionNamespace getVariable [" SA_MAX_TOWED_CARGO" ,1 ];
68+ _maxTowedCargo = missionNamespace getVariable [" SA_MAX_TOWED_CARGO" ,2 ];
6969 _runSimulation = true ;
7070
7171 private [" _currentVehicle" ," _totalCargoMass" ," _totalCargoCount" ," _findNextCargo" ," _towRopes" ," _ropeLength" ];
@@ -126,7 +126,7 @@ SA_Simulate_Towing = {
126126 private [" _vehicleHitchPosition" ," _cargoHitchPosition" ," _newCargoHitchPosition" ," _cargoVector" ," _movedCargoVector" ," _attachedObjects" ," _currentCargo" ];
127127 private [" _newCargoDir" ," _lastCargoVectorDir" ," _newCargoPosition" ," _doExit" ," _cargoPosition" ," _vehiclePosition" ," _maxVehicleSpeed" ," _vehicleMass" ," _cargoMass" ," _cargoCanFloat" ];
128128 private [" _cargoCorner1AGL" ," _cargoCorner1ASL" ," _cargoCorner2AGL" ," _cargoCorner2ASL" ," _cargoCorner3AGL" ," _cargoCorner3ASL" ," _cargoCorner4AGL" ," _cargoCorner4ASL" ," _surfaceNormal1" ," _surfaceNormal2" ," _surfaceNormal" ];
129- private [" _cargoCenterASL" ," _surfaceHeight" ," _surfaceHeight2" ," _maxSurfaceHeight" ];
129+ private [" _cargoCenterASL" ," _surfaceHeight" ," _surfaceHeight2" ," _maxSurfaceHeight" , " _cargoSpeedMetersPerSec " ];
130130
131131 _maxVehicleSpeed = getNumber (configFile >> " CfgVehicles" >> typeOf _vehicle >> " maxSpeed" );
132132 _cargoCanFloat = if ( getNumber (configFile >> " CfgVehicles" >> typeOf _cargo >> " canFloat" ) == 1 ) then { true } else { false };
@@ -136,7 +136,7 @@ SA_Simulate_Towing = {
136136 _cargoModelCenterGroundPosition = _cargo worldToModelVisual _cargoCenterOfMassAGL ;
137137 _cargoModelCenterGroundPosition set [0 ,0 ];
138138 _cargoModelCenterGroundPosition set [1 ,0 ];
139- _cargoModelCenterGroundPosition set [2 , (_cargoModelCenterGroundPosition select 2 ) - 0.10 ]; // Adjust height so that it doesn't ride directly on ground
139+ _cargoModelCenterGroundPosition set [2 , (_cargoModelCenterGroundPosition select 2 ) - 0.05 ]; // Adjust height so that it doesn't ride directly on ground
140140
141141 // Calculate cargo model corner points
142142 private [" _cargoCornerPoints" ];
@@ -249,10 +249,14 @@ SA_Simulate_Towing = {
249249 _vehicle setVelocity ((vectorNormalized (velocity _vehicle )) vectorMultiply (_massAdjustedMaxSpeed / 3.6 ));
250250 };
251251
252- _cargo setVelocity ((vectorDir _cargo ) vectorMultiply (vectorMagnitude (velocity _vehicle )));
252+ // Simulate cargo velocity. Only applies if the simulated velocity is >= 0 meters per sec.
253+ _cargoSpeedMetersPerSec = (velocity _vehicle ) vectorDotProduct _newCargoDir ;
254+ if (_cargoSpeedMetersPerSec >= 0 ) then {
255+ _cargo setVelocity (_newCargoDir vectorMultiply _cargoSpeedMetersPerSec );
256+ };
253257
254258 } else {
255-
259+
256260 if (_lastMovedCargoPosition distance _cargoPosition > 2 ) then {
257261 _lastCargoHitchPosition = _cargo modelToWorld _cargoHitchModelPos ;
258262 _lastCargoVectorDir = vectorDir _cargo ;
@@ -682,6 +686,7 @@ SA_TOW_RULES = [
682686 [" Tank" ," CAN_TOW" ," Car" ],
683687 [" Tank" ," CAN_TOW" ," Ship" ],
684688 [" Tank" ," CAN_TOW" ," Air" ],
689+ [" Car" ," CAN_TOW" ," Tank" ],
685690 [" Car" ," CAN_TOW" ," Car" ],
686691 [" Car" ," CAN_TOW" ," Ship" ],
687692 [" Car" ," CAN_TOW" ," Air" ],
0 commit comments