Jump to content
maverickzer0

Getting a Backpack to float.

Recommended Posts

I've been trying to get a backpack in the 3DEN editor to float in the air like you can most other objects. As I understand it, backpacks are exempt from this as they are not handled like other physics objects and therefore just spawn on the ground. 
All I need it for is a screenshot, I don't need the backpack to be interactable nor do I need it to move, just to stay in place and not drop to the floor. I've attempted to use the attachTo command and the attatchToRelative as well as converting a simple object like a cone into a backpack - which worked - but still ended up with the backpack spawning on the ground.

 

Any help would be appreciated. 

Share this post


Link to post
Share on other sites

Just spawn it as a simple object using the backpack's model...

Spoiler

TAG_fnc_displayBackpack = {
	params[ [ "_backpackType", objNull, [ objNull, "", configFile ] ] ];
	
	if ( _backpackType isEqualType objNull && { isNull _backpackType } ) exitWith{ objNull };
	
	if ( _backpackType isEqualType objNull ) then {
		_backpackType = typeOf _backpackType;
	};
	
	if ( _backpackType isEqualType "" ) then {
		_backpackType = configFile >> "CfgVehicles" >> _backpackType;
	};
	
	if !( isClass( _backpackType ) ) exitWith{ objNull };
	
	private _model = getText( _backpackType >> "model" );
	
	if ( _model select[ 0, 1 ] == "\" ) then {
		_model = _model select[ 1, count _model ];
	};
	
	private _eyeHeight = ASLToAGL( eyePos player ) select 2;
	private _pos = AGLToASL( player getPos[ 4, getDir player ] vectorAdd[ 0, 0, _eyeHeight ] );
	private _object = createSimpleObject[ _model, _pos, true ];
	_object setDir ( _object getDir player );
	
	_object
};

backpack player call TAG_fnc_displayBackpack;

 

 

Or line up a nice shot of the players backpack in the editor, using the arsenal sphere as a backdrop.

Spoiler

TAG_fnc_displayBackpack = {
	params[ [ "_backpackType", objNull, [ objNull, "", configFile ] ] ];

	if ( _backpackType isEqualType objNull && { isNull _backpackType } ) exitWith{ objNull };

	if ( _backpackType isEqualType objNull ) then {
		_backpackType = typeOf _backpackType;
	};

	if ( _backpackType isEqualType "" ) then {
		_backpackType = configFile >> "CfgVehicles" >> _backpackType;
	};

	if !( isClass( _backpackType ) ) exitWith{ objNull };

	private _centerPos = [0,0,10];
	private _sphere = createVehicle[ "Sphere_3DEN", _centerPos, [], 0, "NONE" ];
	_sphere setDir 0;
	_sphere setPosASL _centerPos;
	_sphere setObjectTexture [0,"#(argb,8,8,3)color(0.93,1.0,0.98,0.028,co)"];
	_sphere setObjectTexture [1,"#(argb,8,8,3)color(0.93,1.0,0.98,0.028,co)"];

	private _model = getText( _backpackType >> "model" );

	if ( _model select[ 0, 1 ] == "\" ) then {
		_model = _model select[ 1, count _model ];
	};

	private _object = createSimpleObject[ _model, _centerPos vectorAdd[0,0,5], true ];
	boundingBoxReal _object params[ "_mins", "_maxs" ];
	private _backpackCenter = ( _maxs select 2 - ( _mins select 2 )) / 2;

	_camera = get3DENCamera;
	_camera setPosATL ( _object modelToWorldVisual[ 0, 1.5, _backpackCenter ] );
	_camera setDir 180;

	//screenshot format[ "backpacks\%1.png", configName _backpackType ];

	_object
};

backpack player call TAG_fnc_displayBackpack;

 

 

Or there is also Eden Editor: Configuring Asset Previews that could be useful.

  • Like 3

Share this post


Link to post
Share on other sites
On 10/18/2022 at 2:05 AM, Harzach said:

Backpacks work differently. You need to move the objectParent rather than the backpack.

 

 

 

On 10/18/2022 at 2:13 AM, Larrow said:

Just spawn it as a simple object using the backpack's model...

  Hide contents


TAG_fnc_displayBackpack = {
	params[ [ "_backpackType", objNull, [ objNull, "", configFile ] ] ];
	
	if ( _backpackType isEqualType objNull && { isNull _backpackType } ) exitWith{ objNull };
	
	if ( _backpackType isEqualType objNull ) then {
		_backpackType = typeOf _backpackType;
	};
	
	if ( _backpackType isEqualType "" ) then {
		_backpackType = configFile >> "CfgVehicles" >> _backpackType;
	};
	
	if !( isClass( _backpackType ) ) exitWith{ objNull };
	
	private _model = getText( _backpackType >> "model" );
	
	if ( _model select[ 0, 1 ] == "\" ) then {
		_model = _model select[ 1, count _model ];
	};
	
	private _eyeHeight = ASLToAGL( eyePos player ) select 2;
	private _pos = AGLToASL( player getPos[ 4, getDir player ] vectorAdd[ 0, 0, _eyeHeight ] );
	private _object = createSimpleObject[ _model, _pos, true ];
	_object setDir ( _object getDir player );
	
	_object
};

backpack player call TAG_fnc_displayBackpack;

 

 

Or line up a nice shot of the players backpack in the editor, using the arsenal sphere as a backdrop.

  Reveal hidden contents


TAG_fnc_displayBackpack = {
	params[ [ "_backpackType", objNull, [ objNull, "", configFile ] ] ];

	if ( _backpackType isEqualType objNull && { isNull _backpackType } ) exitWith{ objNull };

	if ( _backpackType isEqualType objNull ) then {
		_backpackType = typeOf _backpackType;
	};

	if ( _backpackType isEqualType "" ) then {
		_backpackType = configFile >> "CfgVehicles" >> _backpackType;
	};

	if !( isClass( _backpackType ) ) exitWith{ objNull };

	private _centerPos = [0,0,10];
	private _sphere = createVehicle[ "Sphere_3DEN", _centerPos, [], 0, "NONE" ];
	_sphere setDir 0;
	_sphere setPosASL _centerPos;
	_sphere setObjectTexture [0,"#(argb,8,8,3)color(0.93,1.0,0.98,0.028,co)"];
	_sphere setObjectTexture [1,"#(argb,8,8,3)color(0.93,1.0,0.98,0.028,co)"];

	private _model = getText( _backpackType >> "model" );

	if ( _model select[ 0, 1 ] == "\" ) then {
		_model = _model select[ 1, count _model ];
	};

	private _object = createSimpleObject[ _model, _centerPos vectorAdd[0,0,5], true ];
	boundingBoxReal _object params[ "_mins", "_maxs" ];
	private _backpackCenter = ( _maxs select 2 - ( _mins select 2 )) / 2;

	_camera = get3DENCamera;
	_camera setPosATL ( _object modelToWorldVisual[ 0, 1.5, _backpackCenter ] );
	_camera setDir 180;

	//screenshot format[ "backpacks\%1.png", configName _backpackType ];

	_object
};

backpack player call TAG_fnc_displayBackpack;

 

 

Or there is also Eden Editor: Configuring Asset Previews that could be useful.


Thanks for both the replies, but i found this thread on Reddit which emulated what I wanted pretty much perfectly. Though, on a separate but kind of the same topic, anyone have a list of particle effect class names? I've figured out how to spawn particle effects in but I can't find a list of them anywhere. 

 

  • Like 2

Share this post


Link to post
Share on other sites
3 hours ago, maverickzer0 said:

Thanks for both the replies, but i found this thread on Reddit which emulated what I wanted pretty much perfectly. 

 

That is functionally the equivalent of @Larrow's first solution above - creating a simple object.

Share this post


Link to post
Share on other sites
19 hours ago, maverickzer0 said:

anyone have a list of particle effect class names

See CfgCloudlets in the config viewer. Some particle effects rely on engine parameters so may not spawn properly/look correct.

 

This page may be useful Arma 3: Particle Effects

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

×