Jump to content
OldManVegas

Forcing rotation on a composition / Un-editable rotation.

Recommended Posts

Howdy ho, I've recently had an Idea for a mission but I might have hit a wall before getting a foot out of the door.

 

I need to adjust the rotation of an item, a CUP composition HLD (Helicopter Landing Deck) WASP-Class ship. The item consists of a load of separate structures, divided up into a lot of different little things, however they all still appear under a single item in the 3den editor. Any time I try to adjust their yaw, pitch, trim, whatever you want to call it, the carrier remains upright and refuses to change, possible with catastrophic side effects, sometimes the hull the just fragments into a couple of pieces as below. I am rather new to editing missions and what not, but I have consulted a few of the mission developers in the community I play it and they're not too sure about it.


One has recommended finding the spawn script and modifying it, but I'm not sure how I'd go about that.


If you have any other suggestions, please let me know! I'd hate to waste the idea.

 

 

 

 

097769dce0.png

Share this post


Link to post
Share on other sites

well. During runtime you may want to try: 

setDir

ex:

myCoolLHDThatDoesntBreak setDir 90; //rotation isn't necessary from 0-360

 

Share this post


Link to post
Share on other sites

Okay, so. I've been a bit of the work for you and had a look at the decompiled config files for CUP, as well as the functions that handle ship spawning.

This is an example of how the ship composition looks like behind the scenes. 

As you can see in the init eventHandler for this ship, there is a function being called, that handles spawning the actual parts the ship is composed off:

"BIS_fnc_initShip"

The following is the function header:

/* ----------------------------------------------------------------------------
Function: CUP_fnc_initShip
Description:
Initializes a large CUP ship by building the component parts and loading any cargo

Parameters:
_this select 0: OBJECT - Reference to ship
_this select 1: BOOLEAN - Select whether or not to spawn ship with typical cargo

Returns:
Nil

Examples:
(begin example)
	[_this select 0, true] call CUP_fnc_initShip;
(end)

See Also:

Author:
Tupolov

Peer Reviewed:
nil
---------------------------------------------------------------------------- */

Going from the source code of said function, the ship parts (as defined in shipParts[], see LHD Cfg Entry) are being spawned at the same position and in the same direction as the actual ship object.

This can be seen here:

// Taken from: CUP_fnc_shipInit
// Written by: Tupolov, CUP Team

// Spawns the individual ship parts.
_parts = [];
{
	private ["_section"];
	_section = _x createVehicle _shipPos;
	_section setDir _dir;
	_section setPos _shipPos;

	_parts pushBack _section;
} forEach _shipParts;

 

Maybe you could write a mock-up of the function, using exact _dir and _pos values, stored in an array.

If you want the full source code of this function, please send me a PM.

 

Hope this helps.

Best regards,

Mokka

Share this post


Link to post
Share on other sites

setDir and setPos are the reasons why composition is broken. They only work for horizontal orientation.

Use setVectorDirAndUp (not setDir + setVectorUp!) and setPosASL with exact same values set for all sections.

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

×