createSimpleObject: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(local)
m (Text replacement - "\[\[Arma 3 ([^ACHJKLMTZ|])([^|]+)\]\]" to "Arma 3: $1$2")
(41 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
|arma3|= Game name
|1.58|= Game version
|eff= global|= Effects in MP


| Create object with given shape defined as path to .p3d model. Supported [[LOD]]s include [[LOD#Geometry|Geometry]], [[LOD#Fire_Geometry|Fire Geometry]], [[LOD#Roadway|Roadway]], [[LOD#ViewGeometry|View Geometry]] and [[LOD#ShadowVolume|ShadowVolume]]. Supported features include collision, texturing, animation, penetration, AI spotting occlusion, and surface specific sounds (like footsteps). Unsupported features include PhysX, damage, AI pathfinding (causes walking through walls), and built in lights.<br><br>
|game1= arma3


Given the simulation limitations, global decorative objects can be created with very little network traffic. Objects that could be exclusively created with this command are: trees, bushes, rocks, bridges, roads, vehicle wrecks, custom models in mission, and other objects without a class in config. The height of the placement position might need to be adjusted experimentally. Some of the model examples could be found here: [[createSimpleObject/objects]]<br><br>
|version1= 1.58


Guide: [[Arma 3 Simple Objects]]<br><br>
|eff= global


{{Informative|One '''cannot''' attach actions to a simple object via [[addAction]].}}
|gr1= Object Manipulation


'''NOTES''':
|descr= Create object with given shape defined as path to .p3d model. Supported [[LOD]]s include [[LOD#Geometry|Geometry]], [[LOD#Fire_Geometry|Fire Geometry]], [[LOD#Roadway|Roadway]], [[LOD#ViewGeometry|View Geometry]] and [[LOD#ShadowVolume|ShadowVolume]]. Supported features include collision, texturing, animation, penetration, AI spotting occlusion, and surface specific sounds (like footsteps). Unsupported features include PhysX, damage, AI pathfinding (causes walking through walls), and built in lights.<br><br>
 
Given the simulation limitations, global decorative objects can be created with very little network traffic. Objects that could be exclusively created with this command are: trees, bushes, rocks, bridges, roads, vehicle wrecks, custom models in mission, and other objects without a class in config. The height of the placement position might need to be adjusted experimentally. Some of the model examples could be found here: [[createSimpleObject/objects]]. For Livonia furniture see: [[Arma 3 Livonia Props]].
 
<br><br>
Guide: [[Arma 3: Simple Objects]]
<br><br>
 
{{Feature | Informative |
* One '''cannot''' attach actions to a simple object via [[addAction]].
* Objects created with Syntax 1 cannot be textured. Some objects may also have inverted default direction.  
* Objects created with Syntax 1 cannot be textured. Some objects may also have inverted default direction.  
* Objects created with Syntax 2 can be textured. The default direction should match the direction of the object if it was created with [[createVehicle]].
* Objects created with Syntax 2 can be textured. The default direction should match the direction of the object if it was created with [[createVehicle]].
* Before {{arma3}} v1.96, local simple objects could not be created.
* Before {{arma3}} v1.67, simple objects did not support [[getVariable|get]]/[[setVariable]].
}}
{{Feature | important | The path to the .p3d model must '''not''' start with a backslash:
{{{!}}
{{!}} {{Icon|unchecked}} {{!}}{{!}} <tt>"'''\'''a3\armor_f_beta...</tt>
{{!}}-
{{!}} {{Icon|checked}} {{!}}{{!}} <tt>"a3\armor_f_beta...</tt>
{{!}}}
}}


Since Arma 3 v1.67 simple objects support [[setVariable]] and [[getVariable]]
|s1= '''createSimpleObject''' [shapeName, positionWorld, local]
|DESCRIPTION=
|p1= [shapeName, positionWorld, local]: [[Array]]
|p2= shapeName: [[String]] - Path to the 3d model (can be obtained with [[getModelInfo]] command)


| '''createSimpleObject''' [shapeName, positionWorld, local] |SYNTAX=
|p3= positionWorld: [[Array]] - placement position in format [[PositionWorld]]
|p1= [shapeName, positionWorld]: [[Array]]|=
|p4= local (Optional): [[Boolean]] - [[true]] to create local instance only. Default: [[false]] (since Arma 3 v1.96)
|p2= shapeName: [[String]] - Path to the 3d model (can be obtained with [[getModelInfo]] command) |PARAMETER1=
|r1= [[Object]] - Created simple object
|p3= positionWorld: [[Array]] - placement position in format [[PositionWorld]] |PARAMETER2=
|p4= local: [[Boolean]] - (Optional, since Arma 3 1.95.145745) |PARAMETER3=
| [[Object]] - Created simple object |RETURNVALUE=


|s2= '''createSimpleObject''' [className, positionASL, local] |SYNTAX=
|s2= '''createSimpleObject''' [className, positionASL, local]
|p21= [className, positionASL] : [[Array]]|=
 
|p22= className: [[String]] - [[CfgVehicles]] config class name|PARAMETER1=
|p21= [className, positionASL, local] : [[Array]]
|p23= positionASL: [[Array]] - placement position in format [[PositionASL]] |PARAMETER2=
 
|p24= local: [[Boolean]] - (Optional, since Arma 3 1.95.145745) |PARAMETER3=
|p22= className: [[String]] - [[CfgVehicles]] config class name
|r2= [[Object]] - Created simple object |RETURNVALUE=
|p23= positionASL: [[Array]] - placement position in format [[PositionASL]]
|p24= local (Optional): [[Boolean]] - [[true]] to create local instance only. Default: [[false]] (since Arma 3 v1.96)
|r2= [[Object]] - Created simple object


|x1= <code>_pos = [[player]] [[getRelPos]] [10, 0];
|x1= <code>_pos = [[player]] [[getRelPos]] [10, 0];
Line 42: Line 58:
   
   
_tank [[animate]] ["Wheel_podkoloL3", 0.5, [[true]]];
_tank [[animate]] ["Wheel_podkoloL3", 0.5, [[true]]];
_tank [[animate]] ["Wheel_podkoloL6", 0.5, [[true]]];</code>|EXAMPLE1=
_tank [[animate]] ["Wheel_podkoloL6", 0.5, [[true]]];</code>


|x2= <code>_pos = [[player]] [[getRelPos]] [10, 0];  
|x2= <code>_pos = [[player]] [[getRelPos]] [10, 0];  
Line 53: Line 69:
    
    
_tank [[animate]] ["Wheel_podkoloL3", 0.5, [[true]]];  
_tank [[animate]] ["Wheel_podkoloL3", 0.5, [[true]]];  
_tank [[animate]] ["Wheel_podkoloL6", 0.5, [[true]]];</code>|EXAMPLE2=
_tank [[animate]] ["Wheel_podkoloL6", 0.5, [[true]]];</code>


| [[isSimpleObject]], [[hideSelection]], [[selectionPosition]], [[getModelInfo]], [[getObjectType]], [[cursorObject]], [[selectionNames]], [[animationNames]], [[createVehicle]], [[enableSimulation]], [[hideObject]], [[Arma_3_Simple_Objects|Simple Objects Guide]] |SEEALSO=
|seealso= [[isSimpleObject]], [[hideSelection]], [[selectionPosition]], [[getModelInfo]], [[getObjectType]], [[cursorObject]], [[selectionNames]], [[animationNames]], [[createVehicle]], [[enableSimulation]], [[hideObject]], [[getMissionPath]], [[Arma_3_Simple_Objects|Simple Objects Guide]]
|  |MPBEHAVIOUR=
}}
}}


<h3 style='display:none'>Bottom Section</h3>
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
<h3 style='display:none'>Notes</h3>
<dl class="command_description">
<!-- BEGIN Note Section -->
<!-- END Note Section -->
</dl>
<h3 style="display:none">Bottom Section</h3>
<!-- CONTINUE Notes -->
<dl class="command_description">
<dl class="command_description">
<dt></dt>
<dd class="notedate">Posted on April 18, 2016 - 20:03 (UTC)</dd>
<dd class="notedate">Posted on April 18, 2016 - 20:03 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
Line 79: Line 81:
<code>_heli = "B_Heli_Light_01_F" [[createVehicleLocal]] ([[player]] [[getRelPos]] [10, 0]);
<code>_heli = "B_Heli_Light_01_F" [[createVehicleLocal]] ([[player]] [[getRelPos]] [10, 0]);
_position = [[getPosWorld]] _heli;
_position = [[getPosWorld]] _heli;
_vectorDirUp = <nowiki>[</nowiki>[[vectorDir]] _heli, [[vectorUp]] _heli];
_vectorDirUp = [<nowiki/>[[vectorDir]] _heli, [[vectorUp]] _heli];
_model = [[getModelInfo]] _heli [[select]] 1;
_model = [[getModelInfo]] _heli [[select]] 1;
[[deleteVehicle]] _heli;
[[deleteVehicle]] _heli;
Line 85: Line 87:
_simpleHeli [[setVectorDirAndUp]] _vectorDirUp;</code>
_simpleHeli [[setVectorDirAndUp]] _vectorDirUp;</code>
</dd>
</dd>
</dl>
<dt><dt>
<!-- DISCONTINUE Notes -->
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on April 28, 2016 - 18:10 (UTC)</dd>
<dd class="notedate">Posted on April 28, 2016 - 18:10 (UTC)</dd>
<dt class="note">[[User:Waffle SS.|Waffle SS.]]</dt>
<dt class="note">[[User:Waffle SS.|Waffle SS.]]</dt>
<dd class="note">
<dd class="note">
Models from within the mission file/folder can be created, but full system path is needed. Use:
Models from within the mission file/folder can be created, but full system path is needed. Use: [[getMissionPath]]
<code>([[str]] [[missionConfigFile]] [[select]] [0, [[count]] [[str]] [[missionConfigFile]] - 15]) + "myModel.p3d"
//mission folder path code from: http://killzonekid.com/arma-scripting-tutorials-mission-root/</code>
</dd>
</dd>
</dl>
<dt><dt>
<!-- DISCONTINUE Notes -->
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on May 11, 2016 - 01:28 (UTC)</dd>
<dd class="notedate">Posted on May 11, 2016 - 01:28 (UTC)</dd>
<dt class="note">[[User:Waffle SS.|Waffle SS.]]</dt>
<dt class="note">[[User:Waffle SS.|Waffle SS.]]</dt>
Line 107: Line 99:
[[simulationEnabled]] returns false.
[[simulationEnabled]] returns false.
</dd>
</dd>
</dl>
<dt><dt>
<!-- DISCONTINUE Notes -->
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on September 5, 2016 - 15:10 (UTC)</dd>
<dd class="notedate">Posted on September 5, 2016 - 15:10 (UTC)</dd>
<dt class="note">[[User:Warka|Warka]]</dt>
<dt class="note">[[User:Warka|Warka]]</dt>
Line 135: Line 123:
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 20:32, 7 April 2021

Hover & click on the images for description

Description

Description:
Create object with given shape defined as path to .p3d model. Supported LODs include Geometry, Fire Geometry, Roadway, View Geometry and ShadowVolume. Supported features include collision, texturing, animation, penetration, AI spotting occlusion, and surface specific sounds (like footsteps). Unsupported features include PhysX, damage, AI pathfinding (causes walking through walls), and built in lights.

Given the simulation limitations, global decorative objects can be created with very little network traffic. Objects that could be exclusively created with this command are: trees, bushes, rocks, bridges, roads, vehicle wrecks, custom models in mission, and other objects without a class in config. The height of the placement position might need to be adjusted experimentally. Some of the model examples could be found here: createSimpleObject/objects. For Livonia furniture see: Arma 3 Livonia Props.

Guide: Arma 3: Simple Objects

  • One cannot attach actions to a simple object via addAction.
  • Objects created with Syntax 1 cannot be textured. Some objects may also have inverted default direction.
  • Objects created with Syntax 2 can be textured. The default direction should match the direction of the object if it was created with createVehicle.
  • Before Arma 3 v1.96, local simple objects could not be created.
  • Before Arma 3 v1.67, simple objects did not support get/setVariable.
The path to the .p3d model must not start with a backslash:
Unchecked "\a3\armor_f_beta...
Checked "a3\armor_f_beta...
Groups:
Object Manipulation

Syntax

Syntax:
createSimpleObject [shapeName, positionWorld, local]
Parameters:
[shapeName, positionWorld, local]: Array
shapeName: String - Path to the 3d model (can be obtained with getModelInfo command)
positionWorld: Array - placement position in format PositionWorld
local (Optional): Boolean - true to create local instance only. Default: false (since Arma 3 v1.96)
Return Value:
Object - Created simple object

Alternative Syntax

Syntax:
createSimpleObject [className, positionASL, local]
Parameters:
[className, positionASL, local] : Array
className: String - CfgVehicles config class name
positionASL: Array - placement position in format PositionASL
local (Optional): Boolean - true to create local instance only. Default: false (since Arma 3 v1.96)
Return Value:
Object - Created simple object

Examples

Example 1:
_pos = player getRelPos [10, 0]; _tank = createSimpleObject ["a3\armor_f_beta\apc_tracked_01\apc_tracked_01_rcws_f.p3d", _pos]; _tank setPos (_pos vectorAdd (getPosWorld _tank vectorDiff (_tank modelToWorld [0,0,0]))); _tank hideSelection ["zasleh", true]; _tank hideSelection ["zasleh2", true]; _tank hideSelection ["clan", true]; _tank animate ["Wheel_podkoloL3", 0.5, true]; _tank animate ["Wheel_podkoloL6", 0.5, true];
Example 2:
_pos = player getRelPos [10, 0]; _tank = createSimpleObject ["B_APC_Tracked_01_CRV_F", AGLtoASL _pos]; _tank setObjectTexture [0, "#(rgb,8,8,3)color(0,1,0,0.01)"]; _tank hideSelection ["zasleh", true]; _tank hideSelection ["zasleh2", true]; _tank hideSelection ["clan", true]; _tank animate ["Wheel_podkoloL3", 0.5, true]; _tank animate ["Wheel_podkoloL6", 0.5, true];

Additional Information

See also:
isSimpleObjecthideSelectionselectionPositiongetModelInfogetObjectTypecursorObjectselectionNamesanimationNamescreateVehicleenableSimulationhideObjectgetMissionPathSimple Objects Guide

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
Posted on April 18, 2016 - 20:03 (UTC)
Killzone Kid
The easiest way to correctly place simple object is to create normal object of the same shape from class (if possible), then copy getPosWorld, vectorDir and vectorUp from it. Then create the simple object and apply copied values to it, this will position simple object exactly as normal object was positioned: _heli = "B_Heli_Light_01_F" createVehicleLocal (player getRelPos [10, 0]); _position = getPosWorld _heli; _vectorDirUp = [vectorDir _heli, vectorUp _heli]; _model = getModelInfo _heli select 1; deleteVehicle _heli; _simpleHeli = createSimpleObject [_model, _position]; _simpleHeli setVectorDirAndUp _vectorDirUp;
Posted on April 28, 2016 - 18:10 (UTC)
Waffle SS.
Models from within the mission file/folder can be created, but full system path is needed. Use: getMissionPath
Posted on May 11, 2016 - 01:28 (UTC)
Waffle SS.
simulationEnabled returns false.
Posted on September 5, 2016 - 15:10 (UTC)
Warka
There is a section in function library dedicated to simple object creation and interaction. It's purpose is to simplify the operations:
  • BIS_fnc_createSimpleObject
    • creates simple object according to the supplied data
    • you can supply p3d path, class name or data you get from scanning a non-simple object
  • BIS_fnc_simpleObjectData
    • gathers and returns data about the non-simple object
    • data can be then used to create simple object
  • BIS_fnc_replaceWithSimpleObject
    • replaces non-simple object with simple object on the scene
    • do not use it in large scale in MP missions as it is not network efficient
  • BIS_fnc_adjustSimpleObject
    • adjusts simple object to looks as close to the non-simple object as possible
    • function is internally called from the 'bis_fnc_createSimpleObject', you won't probably need to call this function directly
Check the function headers for more info about the input parameters and possibilities.