Jump to content
Sign in to follow this  
b101_uk

Ropes, default connection point name of a slung load? – (on the load NOT the heli)

Recommended Posts

Does anyone know the default connection point name (toPoint in the ropeCreate Syntax) in a LOD (memory point etc) that will override the behaviour of the ropes connecting to the centre of a LODs volume of a slung load in the absence of such a named point?

As I have some objects that should be connected near the end/s rather than in the centre, this is also to alleviate the problem of the rope/load physics having spasms associated with ropes fixing to the centre of an object which can then freely spin about it Y axis which would not happen if the rope was connected above and forward of the CoG or LOD centre.

I have looked at lots of the BIS modals in O2 and have yet to find a named point, and yes I do know you can name a specific point in memory lod or x,y,z point if using the ropeCreate Syntax but I am looking for the point name used by default when inserting a scripted TkoH attach sling load waypoint so save using the ropeCreate Syntax ;)

Any help would be appreciated.

Share this post


Link to post
Share on other sites

Hi,

I dont think there is any Magical point simply CoG or model coord [0,0,0] that it defaults too.

Zamerny i think was the old center memmory point not sure they still use it these days though .

Share this post


Link to post
Share on other sites

Ok, I have done some investigating and “slingload0†and “slingload1†should be valid points on BOTH the helicopter AND the load, however if a slingload0 & slingload1 is placed in the memory LOD of the load to be lifted nothing happens and the rope WONT connect at all (i.e. the presence of slingload0 or slingload1 in the load to be lifted is enough to override the currant bounding-box method BUT the code or script to actually put the rope to slingload0 or slingload1 is missing/faulty etc thus the rope does not appear and the waypoint stays active)

The reference to slingload0, slingload1 and the bounding box (which is used at the moment) in relation to the slung load & also the helicopter is in “modules_h.pbo†(path within .pbo is: HSim\modules_h\functions\Waypoints\fn_wpSlingLoadAttach.sqf)

The txt of fn_wpSlingLoadAttach.sqf is in the spoiler below, I have tried logical changes to the reference to “_targetPos†being slingload0 or slingload1 in both the “//--- Prepared†and “//--- Attach†sections without luck and I have slingload0 & slingload1 in my memory lod and have tryed using them one at a time.

(tested from tkoh root folder\HSim\modules_h\functions\Waypoints\fn_wpSlingLoadAttach.sqf)

I guess this may be why the medium heli has the as yet unused CargoHook.p3d and CargoHook_military.p3d that fit in the belly, either that or the means to swap between the hook lod1 and the none hook lod2 of the CargoHook.p3d proxy is not yet done like for doors and other bits. found ;)

 /*
Author: Karel Moricky

Description:
Waypoint - Attach sling load

Parameter(s):
(set by waypoint)

Returns:
Nothing
*/


_wpFunction = "BIS_fnc_wpSlingloadAttach";
_wpName = localize "STR_HSIM_BIS_fnc_wpSlingLoadAttach_Name";
#include "variableSettings.hpp"

_delay = 0.1;
_posCounter = 0;
_forced = false;
_posLimit = [_params,0,-1,[0,true]] call bis_fnc_param;
_failCode = [_params,1,{},[{}]] call bis_fnc_param;
_weight = [_params,2,-1,[0]] call bis_fnc_param;
_forced = false;
_PIP = false;
if (typename _posLimit == typename true) then {
_forced = _posLimit;
_posLimit = -1;
};
if (_posLimit < 0) then {_posLimit = _delay};

//--- No target - Mission Accomplished
if (isnull _target) exitwith {};

//--- Smaller default completion radius
if (waypointcompletionradius _wp == 0 && _mode != 2) then {_completionRadius = 42};

_bboxZ = boundingbox _veh select 1 select 2;

//////////////////////////////////////////////////////////////////////////////////////////
//--- Prepared
_checkDistance = {
_veh = vehicle _x;
if (_veh iskindof "Helicopter") then {
	if (isnil {_veh getvariable "BIS_slingload_attach"}) then {
		_limitDistance = if (isplayer driver _veh) then {_completionRadius} else {100};

		//--- Hook point on helicopter
		_vehPos = _veh selectionposition "slingload0";
		_vehPos = if (_vehPos distance [0,0,0] > 0) then {
			_veh modeltoworld _vehPos;
		} else {
			_vehBboxZ = boundingbox _veh select 0 select 2;
			_veh modeltoworld [0,0,_vehBboxZ];
		};

		//--- Hook point on target
		_targetPos = _target selectionposition "slingload0";
		_targetPos = if (_targetPos distance [0,0,0] > 0) then {
			_target modeltoworld _vehPos;
		} else {
			_targetBboxZ = boundingbox _target select 1 select 2;
			_target modeltoworld [0,0,_targetBboxZ];
		};

		//--- Generic Sentences
		if (_vehPos distance _targetPos < _limitDistance * 10 && !_forced) then {


			if !(_PIP) then {
				if !(_forced) then {
					{
						_veh = vehicle _x;
						if (isplayer driver _veh && isplayer _x) then {
							_camPos = _veh selectionposition "slingload0";
							_camPos set [2,(_camPos select 2) - 0.2];
							["rendertarget0",[[_veh,_camPos],_target],_veh,false] call bis_fnc_pip;
							"rendertarget0" setPiPEffect [3, 1.0, 1.0, 1.5, 0.0, [0, 0, 0, 0], [1, 1, 1, 0], [1,1,1,0]];
						};
					} foreach units _group;
				};
				_PIP = true;
			};

			if (abs ((_vehPos select 2) - (_targetPos select 2)) < 50) then {

				//--- Direction
				_dirto = [_veh,_targetPos] call bis_fnc_relativedirto;
				_dirto = floor (((_dirto + 45 + 360) % 360) / 90);
				[
					[
						"FeedbackFlightNegativeDirectionsForward",
						"FeedbackFlightNegativeDirectionsRight",
						"FeedbackFlightNegativeDirectionsBackward",
						"FeedbackFlightNegativeDirectionsLeft"
					] select _dirto
				] call bis_fnc_genericSentence;
			} else {

				//--- Altitude
				if ((_vehPos select 2) > (_targetPos select 2)) then {
					["FeedbackFlightNegativeHeightTooHigh"] call bis_fnc_genericSentence;
				} else {
					["FeedbackFlightNegativeHeightTooLow"] call bis_fnc_genericSentence;
				};
			};
		};

		_vehPos distance _targetPos < _limitDistance
		||
		_forced
	} else {
		false
	};		
} else {
	false
};
};


//////////////////////////////////////////////////////////////////////////////////////////
//--- Condition
waituntil {

_time = time;
waituntil {time - _time > _delay};
if (call _isExpired || isnull _group || isnull _target) exitwith {};

//--- AI Move
{
	_veh = vehicle _x;
	if (_veh iskindof "Helicopter" && !isplayer driver _veh) then {
		_expected = expecteddestination _veh select 0;
		if (_expected distance _target > 50) then {
			_veh domove position _target;
			if (_veh distance _target < 100) then {
				_veh flyinheight 20;
				_veh setspeedmode "limited";
			};
		};
	};

	if (call _checkDistance) then {
		_posCounter = _posCounter + (time - _time);
		if !(_forced) then {
			hintsilent format [(localize "STR_HSIM_BIS_FNC_WPSLINGLOAD_HINT") + " %1%2",round ((_posCounter / _posLimit) * 100) min 100,"%"];
		};
	} else {
		_posCounter = 0
	};
} foreach units _group;

(call _condition && _posCounter >= _posLimit) || _forced
};
if (call _isExpired || isnull _group || isnull _target) exitwith {};


//////////////////////////////////////////////////////////////////////////////////////////
//--- Load

//--- Select suitable helicopters
_heli = if (_mode == 2) then {
_veh
} else {
_listHeli = [];
{
	_veh = vehicle _x;
	if (call _checkDistance) then {
		if !(_veh in _listHeli) then {_listHeli = _listHeli + [_veh]};
	};
} foreach units _group;

//--- Select nearest helicopter
[_listHeli,_target] call BIS_fnc_nearestPosition;
};

//--- Attach


//--- Calculate rope length (default is sum of boundingbox heights of heli and target)
//_ropeLengthDefault = (sizeof typeof _target) / 2 + (sizeof typeof _heli) / 2;
_bboxHeli = boundingbox _heli;
_sizeHeli = abs((_bboxHeli select 0) select 2) + abs((_bboxHeli select 1) select 2);
_bboxTarget = boundingbox _target;
_sizeTarget = abs((_bboxTarget select 0) select 2) + abs((_bboxTarget select 1) select 2);
_ropeLengthDefault = _sizeHeli + _sizeTarget;
_ropeLength = if (_forced || true) then {
_ropeLengthDefault
} else {
(_heli distance _target) max _ropeLengthDefault
};

//--- Get connection points
_targetPos = _target selectionposition "slingload0";
_targetPos = if (_targetPos distance [0,0,0] > 0) then {
"slingload1"
} else {
_targetBboxZ = _bboxTarget select 1 select 2;
[0,0,_targetBboxZ];
};

//--- Connect
_ropeSegments = 10;
_ropeSegmentsLength = (_ropeLength / _ropeSegments);
_rope = ropeCreate [_heli,"slingload0",_target,_targetPos,_ropeSegments,_ropeLength];

//--- Event handlers
_ropeEHcustom = _heli addeventhandler [
"RopeBreak",
_failCode
];
_ropeEH = _heli addeventhandler [
"RopeBreak",
{
	_this spawn {
		_heli = _this select 0;
		_rope = _this select 1;
		_cargo = _heli getvariable ["BIS_slingload_attach",objnull];

		SLINGLOAD_CLEANUP
		sleep 5;
		ropedestroy _rope;

		//--- Mark the cargo as lost
		_cargo setvariable ["BIS_slingload_lost",true];

	};
}
];

//--- Sect custom weight
ropeSetCargoMass [_rope,_target,_weight];

//--- Store attached object variables
_heli setvariable ["BIS_slingload_attach",_target];
_heli setvariable ["BIS_slingload_rope",_rope];
_heli setvariable ["BIS_slingload_ropeEH",_ropeEH];
_heli setvariable ["BIS_slingload_ropeEHcustom",_ropeEH];
_target setvariable ["BIS_slingload_attach",_heli];

//--- Remove PIP
["rendertarget0"] call BIS_fnc_PIP;

200 call _fnc_addRating; 

Edited by b101_uk

Share this post


Link to post
Share on other sites

A couple of things I noticed in the code, not sure if what you tried in your above statement overrode this?

The txt of fn_wpSlingLoadAttach.sqf is in the spoiler below, I have tried logical changes to the reference to “_targetPos†being slingload0 or slingload1 in both the “//--- Prepared†and “//--- Attach†sections without luck and I have slingload0 & slingload1 in my memory lod and have tryed using them one at a time.

(tested from tkoh root folder\HSim\modules_h\functions\Waypoints\fn_wpSli ngLoadAttach.sqf)

On line 61 references _vehPos, it should be _targetPos by the look of it.

//--- Hook point on target
		_targetPos = _target selectionposition "slingload0";
		_targetPos = if (_targetPos distance [0,0,0] > 0) then {
			[color="Red"]_target modeltoworld _vehPos;[/color]
		} else {
			_targetBboxZ = boundingbox _target select 1 select 2;
			_target modeltoworld [0,0,_targetBboxZ];
		};

Then on line 197 where I think the main issue is, as this is where the actual connections and rope creation occurs.

//--- Get connection points
_targetPos = _target selectionposition "slingload0";
_targetPos = if (_targetPos distance [0,0,0] > 0) then {
[color="Red"]"slingload1"[/color]
} else {
_targetBboxZ = _bboxTarget select 1 select 2;
[0,0,_targetBboxZ];
};

From my reading of things I would have thought that would be "slingload0"?

then _targetPos is used below.

_rope = ropeCreate [_heli,"slingload0",_target,_targetPos,_ropeSegments,_ropeLength];

So thinking is most likely in the ropecreate code if the target pos is undefined it defaults to [0,0,0]?

Have you tested by manually creating a rope with your object and using "slingload0" as the targetpos?

Could somebody else check my line of thinking, if correct then a ticket could be created for it.

Hope this helps

Blake.

Edited by blakeace

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×