BIS fnc createSimpleObject: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (Text replacement - "since= Arma3" to "since= arma3")
 
(52 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.62


| arma3 |= Game name
|gr1= Object Manipulation


|1.00|= Game version
|descr= Creates non-simulated framerate and network performance friendly object - a [[Arma 3: Simple Objects|Simple Object]] - and applies different adjustments to fake non-existing physX and engine interactions. The adjustments need either to be stored in the object config or provided as the function input, otherwise they need to be done manually.<br>
____________________________________________________________________________________________
<br>
Simple objects cannot be destroyed and do not interact with the environment. They are useful for creating low performance-demanding static compositions (walls, rocks, wrecks, …) and/or environments where shooting and collisions are not expected.


| <pre>/*
|s1= [input, position, direction, followTerrain, forceSuperSimpleObject, local] call [[BIS_fnc_createSimpleObject]]
Author: Jiri Wainar


Description:
|p1= input: [[String]] or [[Array]]:
Creates non-simulated framerate and network performance friendly object - a simple object - and applies different adjustments to fake non-existing physX and engine interactions. The adjustments need either to be stored in the object config or provided as the function input, otherwise they need to be done manually.
* [[String]]: classname of the object to be created. This is the preferred way if the asset config definition contains the adjustment data or the data are not needed (most objects do not need adjustments).
* [[Array]]: adjustment data in format [class, model, reversed, verticalOffset, animationAdjustments, selectionsToHide]:
** class: [[String]] - (Optional, default "") asset CfgVehicles config class ('''at least either ''model'' or ''class'' must be provided, ideally both''')
** model: [[String]] - (Optional, default "") Path to the vehicle p3d model; needs to start without backslash and must end with the proper file extension ".p3d"
** reversed: [[Number]] - (Optional, default 0) some objects, usually vehicles, are reversed in p3d; valid values are:
*** 1: reverse
*** 0: no change - any value other than 1 will result in no change
** verticalOffset: [[Number]] - (Optional, default 0) fix for non-existant physX; usually needed only for vehicles
** animationAdjustments: [[Array]] - (Optional, default <sqf inline>[]</sqf>) animation that need to be animated to given state, in format [animationName, animationState]:
*** animationName: [[String]] - animation name
*** animationState: [[Number]] - animation state
** selectionsToHide: [[Array]] - (Optional, default <sqf inline>[]</sqf>) all listed selections will be hidden


Simple objects cannot be destroyed and do not interact with the environment. They are usefull for creation low performance demanding static compositions (walls, rocks, wrecks, ...) and/or environments where shooting and collisions are not expected.
|p2= position: [[Array]] format [[Position#PositionASL|PositionASL]] - the object will be placed by the '''model centre'''<nowiki/>'s position (see [[getPosWorld]])


Parameter(s):
|p3= direction: [[Number]] - (Optional, default 0)
0: STRING - classname of the object to be created. This is preffered way if the asset config definition contains the adjustment data or the data are not needed (most objects do not need adjustments).
  or
  ARRAY - creation data array; can be obtained by scanning the normal simulated object on scene with bis_fnc_simpleObjectData and then either added to the asset config or used straight away in the bis_fnc_createSimpleObject function.
1: ARRAY - position; ASL coordinates if classname is known, World coordinates if using p3d only
2: SCALAR - direction  (default: 0)
3: BOOL - aligned to terrain (default: true); true: aligned to terrain, false: horizontal placement
4: BOOL - force super-simple object (default: false); true: super-simple object will be force, no type info or re-texturing is available, false: super-simple object is used unless re-texturing is possible


Returns:
|p4= followTerrain: [[Boolean]] - (Optional, default [[true]]) [[true]] to follow terrain inclination, [[false]] to be horizontally aligned
OBJECT - a simple object or objNull if creation failed


Example:
|p5= forceSuperSimpleObject: [[Boolean]] - (Optional, default [[false]]) [[true]] to create a '''Super Simple Object''' from p3d path (that '''must''' be provided)
_simpleObject:object = [_class:string,_position:array(,_direction:scalar,_aligned:bool)] call bis_fnc_createSimpleObject;
_simpleObject:object = [_model:string,_position:array(,_direction:scalar,_aligned:bool)] call bis_fnc_createSimpleObject;
_simpleObject:object = [_data:array,_position:array(,_direction:scalar,_aligned:bool)] call bis_fnc_createSimpleObject;


See also:
|p6= local: [[Boolean]] - (Optional, default [[false]]) [[true]] to create [[local]] instance of the object
* bis_fnc_createSimpleObject
|p6since= arma3 2.08
* bis_fnc_replaceWithSimpleObject
* bis_fnc_simpleObjectData
* bis_fnc_exportCfgVehiclesSimpleObjectData
* bis_fnc_diagMacrosSimpleObjectData
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|r1= [[Object]] - the created Simple Object, [[objNull]] if creation failed
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_createSimpleObject]]; --> |= Syntax
|x1= <sqf>["B_Boat_Armed_01_minigun_F", getPosWorld player, getDir player] call BIS_fnc_createSimpleObject;</sqf>
|p1= |= Parameter 1


| |= Return value
|x2= <sqf>["B_Boat_Armed_01_minigun_F", player modelToWorldWorld [0,5,0], getDir player + 90, false, false] call BIS_fnc_createSimpleObject;</sqf>
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[Arma 3: Simple Objects]] [[createSimpleObject]] [[BIS_fnc_adjustSimpleObject]] [[BIS_fnc_replaceWithSimpleObject]] [[BIS_fnc_simpleObjectData]] [[getPosWorld]] [[setPosWorld]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: SimpleObjects|{{uc:createSimpleObject}}]]
[[Category:Functions|{{uc:createSimpleObject}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:createSimpleObject}}]]

Latest revision as of 16:26, 9 February 2024

Hover & click on the images for description

Description

Description:
Creates non-simulated framerate and network performance friendly object - a Simple Object - and applies different adjustments to fake non-existing physX and engine interactions. The adjustments need either to be stored in the object config or provided as the function input, otherwise they need to be done manually.

Simple objects cannot be destroyed and do not interact with the environment. They are useful for creating low performance-demanding static compositions (walls, rocks, wrecks, …) and/or environments where shooting and collisions are not expected.
Execution:
call
Groups:
Object Manipulation

Syntax

Syntax:
[input, position, direction, followTerrain, forceSuperSimpleObject, local] call BIS_fnc_createSimpleObject
Parameters:
input: String or Array:
  • String: classname of the object to be created. This is the preferred way if the asset config definition contains the adjustment data or the data are not needed (most objects do not need adjustments).
  • Array: adjustment data in format [class, model, reversed, verticalOffset, animationAdjustments, selectionsToHide]:
    • class: String - (Optional, default "") asset CfgVehicles config class (at least either model or class must be provided, ideally both)
    • model: String - (Optional, default "") Path to the vehicle p3d model; needs to start without backslash and must end with the proper file extension ".p3d"
    • reversed: Number - (Optional, default 0) some objects, usually vehicles, are reversed in p3d; valid values are:
      • 1: reverse
      • 0: no change - any value other than 1 will result in no change
    • verticalOffset: Number - (Optional, default 0) fix for non-existant physX; usually needed only for vehicles
    • animationAdjustments: Array - (Optional, default []) animation that need to be animated to given state, in format [animationName, animationState]:
      • animationName: String - animation name
      • animationState: Number - animation state
    • selectionsToHide: Array - (Optional, default []) all listed selections will be hidden
position: Array format PositionASL - the object will be placed by the model centre's position (see getPosWorld)
direction: Number - (Optional, default 0)
followTerrain: Boolean - (Optional, default true) true to follow terrain inclination, false to be horizontally aligned
forceSuperSimpleObject: Boolean - (Optional, default false) true to create a Super Simple Object from p3d path (that must be provided)
since Arma 3 logo black.png2.08
local: Boolean - (Optional, default false) true to create local instance of the object
Return Value:
Object - the created Simple Object, objNull if creation failed

Examples

Example 1:
["B_Boat_Armed_01_minigun_F", getPosWorld player, getDir player] call BIS_fnc_createSimpleObject;
Example 2:
["B_Boat_Armed_01_minigun_F", player modelToWorldWorld [0,5,0], getDir player + 90, false, false] call BIS_fnc_createSimpleObject;

Additional Information

See also:
Arma 3: Simple Objects createSimpleObject BIS_fnc_adjustSimpleObject BIS_fnc_replaceWithSimpleObject BIS_fnc_simpleObjectData getPosWorld setPosWorld

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note