Jump to content
Nicoman35

Automatically find suitable vehicle attach point

Recommended Posts

I am thinking about making an action allowing the player to attach a parachute to a vehicle. I would like to use the bergen backpack as 'container' for the visual representation. 

Problem: How do I find an attach point automatically for any kind of vehicle, so that the look would make sense. It should look more like this

https://www.mediafire.com/view/qep962tjtznudmw/1.jpg/file

And not like this

https://www.mediafire.com/view/vzhk4j6fq3n9d1a/2.jpg/file

 

Has anyone made a nice funktion for such a purpouse already?

Share this post


Link to post
Share on other sites
On 5/23/2022 at 2:06 PM, Nicoman35 said:

find an attach point automatically for any kind of vehicle

simply not possible. you ve to create some kind of configuration array for every single vehicle you want to support.

Share this post


Link to post
Share on other sites

You can use the sling load memory points:

getArray (configOf yourVehicle  >> "slingLoadCargoMemoryPoints")

Note: configOf yourvehicle (object)     is same as     configfile >> "CfgVehicles" >> typeOf yourVehicle   (where typeOf yourVehicle is a class name)

 

Not sure that works on any vehicle. Test it.

 

For a quadBike you'll get:

getArray (configfile >> "CfgVehicles" >> "B_Quadbike_01_F"  >> "slingLoadCargoMemoryPoints")  // returns: ["SlingLoadCargo1","SlingLoadCargo2","SlingLoadCargo3","SlingLoadCargo4"]

 

same with getArray (configOf cursorObject  >> "slingLoadCargoMemoryPoints") // when you point at a quadBike.

 

Problem: Getting their positions:

If I'm right, you need to work with the objects, with command like selectionPosition. I'm not sure you can find a command or a function working with classes.

 

getarray (configOf cursorObject >> "slingLoadCargoMemoryPoints") apply {cursorObject selectionPosition _x} // will return now: [[-0.447043,0.918197,-0.400729],[0.44327,0.918896,-0.400729],[-0.255609,-1.13709,-0.368357],[0.258668,-1.14754,-0.368357]]

Now you have 4 relative positions for sling load. Feel free to work for a mid-point attaching a unique parachute. You catch the principle.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Point to any vehicle (a vehicle able to be slingloaded) and run the following code. The nearest sling loading position to the player will be highlighted in red:

_veh = cursorTarget;
_selections = (_veh selectionNames "Memory") select {"slingloadcargo" in _x};

addMissionEventHandler ["Draw3D", {
	_thisArgs#0 apply {
		drawIcon3D [
			"",
			[1,1,1,1],
			_thisArgs#1 modelToWorldVisual (_thisArgs#1 selectionPosition [_x, "Memory"]),
			0,
			0,
			0,
			_x,
			2
		];
	};
}, [_selections, _veh]];

_distances = [];
for "_i" from 0 to ((count _selections) - 1) do {
	_distances pushBack (_veh modelToWorldVisual (_veh selectionPosition [_selections#_i, "Memory"]));
	_distances set [_i, [player distance _distances#_i, _distances#_i, _selections#_i]];
};
_distances sort true;

addMissionEventHandler ["Draw3D", {

	drawIcon3D [
		"",
		[1,0,0,1],
		_thisArgs#0 modelToWorldVisual (_thisArgs#0 selectionPosition [_thisArgs#1, "Memory"]),
		0,
		0,
		0,
		_thisArgs#1,
		2
	];
}, [_veh, _distances select 0 select 2]];

 

  • Like 2

Share this post


Link to post
Share on other sites

Why is not possibile to use in config to add slingLoadCargoMemoryPoints array as model coordinates points, example slingLoadCargoMemoryPoints[] = {{0,0.45,1.08},{0,-4.25,0.23}};  this could be done like in transport vehicles class 😞

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

×