BIS fnc spawnObjects: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
(Page filling)
Line 8: Line 8:
____________________________________________________________________________________________
____________________________________________________________________________________________


| <pre>/*
| Create a stack of objects at given position or on top of given object (eg. table). |= Description
____________________________________________________________________________________________


Description:
| [position, className, count, offsetMatrix, offsetDir, dirNoise, enableSimulation] call [[BIS_fnc_spawnObjects]] |= Syntax
Creates an objects or stack of objects at given position or on top of given object (eg. table).


Parameter(s):
|p1= position: [[PositionASL]], or [[Array]] as [referenceObject, placement]
0: _positionASL:array - ASL position where the objects will be spawned
* referenceObject: [[Object]]
* placement: [[String]] - can be:
** "BOTTOM" = at the bottom of the object
** "TOP" = top of the objects boundingbox
** "GROUND" = sitting just on the ground
** "ROADWAY" = sitting just on the ground |= Parameter 1


0: [
|p2= className: [[String]] - class of the object(s) to spawn; all will use the same class |= Parameter 2
_anchorObject:object,   - anchor object (eg. table) defining where the objects will be spawned
_anchorPlacement:string (default = "TOP") - anchor placement definition, valid values are "BOTTOM","TOP","GROUND"
"BOTTOM"  - at the bottom of the object
"TOP"   - top of the objects boundingbox
"GROUND"  - sitting just on the ground
"ROADWAY" - sitting just on the ground
  ]


1: _className:string - class of the objects; all need to have same class
|p3= count: [[Number]] (Optional, default: 1) - how many objects will be spawned |= Parameter 3
2: _count:scalar (default = 1) - number of the object; if > 1 object will be spawned of top of each other
3: _offsetMatrix:array (default = [0,0,0]) - starting spawning position offset
4: _offsetDir:scalar (default = 0) - starting spawning direction offset
5: _dirNoise:code (default = {0}) - spawned object direction delta from the starting direction, defined as code returning dir delta value
6: _enableSimulation:bool (default = false) - shall the simulation of the spawned objects be enabled or not?


Returns:
|p4= offsetMatrix: [[Array]] (Optional, default: [0,0,0]) - starting spawning position offset |= Parameter 4
array of created objects


Example:
|p5= offsetDir: [[Number]] (Optional, default: 0) - starting spawning direction offset |= Parameter 5
_objects = [_position:array,_className:string,_count:scalar,_offsetMatrix:array,_offsetDir:scalar,_dirNoise:code,_enableSimulation:bool] call BIS_fnc_spawnObjects;
_objects = [[_table,"TOP"],"Box_NATO_Wps_F",1,[(random 0.2)-0.1,(random 0.2)-0.1,0],(random 20)-10] call BIS_fnc_spawnObjects;
*/
 
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_spawnObjects]]; --> |= Syntax
|p6= dirNoise: [[Code]] (Optional, default: {0}) - spawned object direction delta from the starting direction, defined as code returning dir delta value |= Parameter 6


|p1= |= Parameter 1
|p7= enableSimulation: [[Boolean]] (Optional, default: false) - shall the simulation of the spawned objects be enabled or not |= Parameter 7


| |= Return value
| [[Array]] of created [[Object|Objects]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________


|x1= <code></code> |=  
|x1= <code>_randomPos = [([[random]] 0.2) -0.1, ([[random]] 0.2) -0.1, 0];
_objects = <nowiki>[</nowiki>[_table, "TOP"], "Box_NATO_Wps_F", 3, _randomPos,([[random]] 20)-10] [[call]] [[BIS_fnc_spawnObjects]];</code> |= Example 1
____________________________________________________________________________________________
____________________________________________________________________________________________


| |= See also
| [[createVehicle]], [[createSimpleObject]], [[enableSimulation]] |= See also


}}
}}

Revision as of 01:38, 4 April 2018


Hover & click on the images for description

Description

Description:
Create a stack of objects at given position or on top of given object (eg. table).
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[position, className, count, offsetMatrix, offsetDir, dirNoise, enableSimulation] call BIS_fnc_spawnObjects
Parameters:
position: PositionASL, or Array as [referenceObject, placement]
  • referenceObject: Object
  • placement: String - can be:
    • "BOTTOM" = at the bottom of the object
    • "TOP" = top of the objects boundingbox
    • "GROUND" = sitting just on the ground
    • "ROADWAY" = sitting just on the ground
className: String - class of the object(s) to spawn; all will use the same class
count: Number (Optional, default: 1) - how many objects will be spawned
offsetMatrix: Array (Optional, default: [0,0,0]) - starting spawning position offset
offsetDir: Number (Optional, default: 0) - starting spawning direction offset
dirNoise: Code (Optional, default: {0}) - spawned object direction delta from the starting direction, defined as code returning dir delta value
enableSimulation: Boolean (Optional, default: false) - shall the simulation of the spawned objects be enabled or not
Return Value:
Array of created Objects

Examples

Example 1:
_randomPos = [(random 0.2) -0.1, (random 0.2) -0.1, 0]; _objects = [[_table, "TOP"], "Box_NATO_Wps_F", 3, _randomPos,(random 20)-10] call BIS_fnc_spawnObjects;

Additional Information

See also:
createVehiclecreateSimpleObjectenableSimulation

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

Notes

Bottom Section