---
name: "setObjectScale"
type: command
status: ok
groups: ["Object Manipulation"]
arma3_since: "2.02"
locality: {"argument": "local", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/setObjectScale
revid: 364325
updated: 2024-05-06T09:38:47Z
---

# setObjectScale

*Command · Object Manipulation · Arma 3 v2.02*

Locality: arguments **local** · effect **global**

## Description

Scales an [attached object](../commands/attachTo.md) or a Simple Object's model - see [#Example 3](../commands/setObjectScale.md#example-3) for various configurations' examples.

## Syntax

```sqf
object setObjectScale scale
```

**Parameters:**

- `object`: [Object](../topics/Object.md) - must be either an [attached object](../commands/attachTo.md) or Simple Object - see [#Example 3](../commands/setObjectScale.md#example-3)
- `scale`: [Number](../topics/Number.md) - in range 0.0001..65504, relative to the object model's normal scale

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
_vehicle attachTo [player, [0,0,0]];
_vehicle setObjectScale 0.1;
```

### Example 2

```sqf
// select an object in Eden Editor and execute the following code in the Debug Console. When moving the object, the effect is reset!
private _object = get3DENSelected "Object" select 0;
_object setObjectScale 0.1;
```

### Example 3

```sqf
// multiple MP-compatible options

// global simple object
private _globalSimpleObject = createSimpleObject ["C_Offroad_01_F", getPosASL player, false];
_globalSimpleObject setObjectScale 0.1; // once is enough as long as it is not moved

// local normal object
private _localNormalObject = "C_Offroad_01_F" createVehicleLocal getPosATL player;
_localNormalObject attachTo [player, [0, 2, 1.5]]; // normal object must be attached
_localNormalObject setObjectScale 0.1; // once is enough as long as it is not moved

// local simple object
private _localSimpleObject = createSimpleObject ["C_Offroad_01_F", getPosASL player, true];
_localSimpleObject setObjectScale 0.1; // once is enough as long as it is not moved
```

### Example 4

```sqf
// a not-so-great EachFrame workaround for a non-attached object

// a normal object that is not attached must be scaled each frame
// make sure the object is LOCAL in order to not saturate the network!
private _localNormalObject = "C_Offroad_01_F" createVehicleLocal getPosATL player;
// the object is not attached to anything
addMissionEventHandler [
    "EachFrame",
    { _thisArgs params ["_obj", "_scale"]; _obj setObjectScale _scale; },
    [_localNormalObject, 0.1]
];
```

### Example 5

```sqf
// only do the following in single player;
// NEVER do such EachFrame in multiplayer!!
// the performance will be terrible, the network will be saturated, the scaling may desync and not be perfect
private _globalNormalObject = "C_Offroad_01_F" createVehicle getPosATL player;
addMissionEventHandler [
    "EachFrame",
    { _thisArgs params ["_obj", "_scale"]; _obj setObjectScale _scale; },
    [_globalNormalObject, 0.1]
];
```

## Problems

The Arma 3 LOD limits still apply, meaning walkable surfaces can only be (~70?)m in size, and collision in general will only work up to (?)m from object center.
This command works on all objects in Eden Editor or scenario preview, but it will not save and will reset when objects get moved. Eden Editor support is only intended for artists.

> [!NOTE]
> Setting the scale of non-simple objects, such as vehicles with players/AI in them, static objects (`simulation = "house"` in config), etc. might be possible,
> but not officially supported. You may encounter issues.

> [!IMPORTANT]
> Changing the direction of the object (e.g. using [setDir](../commands/setDir.md), [setVectorDir](../commands/setVectorDir.md), etc.) will reset the object back to its original size (probably because the engine normalises the directions,
> thus the scale in the transformation matrix becomes 1), so those commands should be run **before** resizing the object.

## See also

[getObjectScale](../commands/getObjectScale.md) · [createVehicleLocal](../commands/createVehicleLocal.md) · [createSimpleObject](../commands/createSimpleObject.md) · [BIS_fnc_createSimpleObject](../functions/BIS_fnc_createSimpleObject.md) · [Multiplayer Scripting](../topics/Multiplayer_Scripting.md)

## Community notes

**P1ker1** — 2022-01-04

Note that

```sqf
_obj setObjectScale 2;
```

doubles the scale factor of an object, not the volume. In the case of a cube this would be the length of an edge.
If you want to multiply the volume, raise the *scale* to the power of 1/3.

```sqf
// Example with 1x1x1 m^3 helper objects
// vectorAdds elevate the cubes so they touch the ground after scaling.
_cube1 = createSimpleObject ["Land_VR_Shape_01_cube_1m_F", getPosASL player vectorAdd [1,3,0.5]];
_cube2 = createSimpleObject ["Land_VR_Shape_01_cube_1m_F", getPosASL player vectorAdd [3,1,0.5]];
_cube3 = createSimpleObject ["Land_VR_Shape_01_cube_1m_F", getPosASL player vectorAdd [1.35,1.35,0.13]];

// Double the side length. V=2^3=8
_cube1 setObjectScale 2;

// Octuple(8x) the volume.    V=(8^(1/3))^3=8
_cube2 setObjectScale 8^(1/3);

// Double the volume.        V=(2^(1/3))^3=2
_cube3 setObjectScale 2^(1/3);
```

<sub>Source: [BI Community Wiki — setObjectScale](https://community.bistudio.com/wiki/setObjectScale) (revision 364325).</sub>
