Arma 3 Scripting

Command in Object Manipulation

createSimpleObject

Also available as Markdown and JSON, or read the original wiki page.

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.

Note

Please note that:

  • addAction does not work with simple objects.
  • 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.
  • only as of Arma 3 v1.68 do simple objects support getVariable and setVariable.

Syntax

Syntax 1

createSimpleObject [shapeName, positionWorld, local]

Parameters:

Returns: Object - created simple object

Syntax 2

createSimpleObject [className, positionASL, local]

Parameters:

Returns: Object - created simple object

Examples

Example 1

private _pos = player getRelPos [10, 0];
private _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

private _pos = player getRelPos [10, 0];
private _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];

Example 3

Create a pond:

private _waterTileModel = "a3\structures_f_enoch\Water\pond_big_01.p3d"; // visual only - this pond is a hard surface
private _tileSize = 18; // width & height
private _tileX = 10;
private _tileY = 5;
private _bottomLeftCorner = getPosWorld player;
private _tilePos = -1;
private _tiles = [];
private _tile = objNull;
for "_y" from 0 to (_tileY - 1) do
{
    for "_x" from 0 to (_tileX - 1) do
    {
        _tilePos = _bottomLeftCorner vectorAdd [_x * _tileSize, _y * _tileSize, 0];
        _tile = createSimpleObject [_waterTileModel, _tilePos];
        _tiles pushBack _tile;
    };
};
sleep 10;
{ deleteVehicle _x } forEach _tiles;

See also

isSimpleObject · hideSelection · selectionPosition · getModelInfo · getObjectType · cursorObject · selectionNames · animationNames · createVehicle · enableSimulation · hideObject · getMissionPath · allLODs · Arma 3: Simple Objects · Arma 3: createSimpleObject/objects

Community notes

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:

private _heli = "B_Heli_Light_01_F" createVehicleLocal (player getRelPos [10, 0]);
private _position = getPosWorld _heli;
private _vectorDirUp = [vectorDir _heli, vectorUp _heli];
private _model = getModelInfo _heli select 1;
deleteVehicle _heli;
private _simpleHeli = createSimpleObject [_model, _position];
_simpleHeli setVectorDirAndUp _vectorDirUp;
Waffle SS.

Models from within the mission file/folder can be created, but full system path is needed. See getMissionPath

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.

POLPOX

Before circa Arma 3 2.07: The path must not start with a backslash:

✗ "**\**a3\armor_f_beta...
✓ "a3\armor_f_beta...