setObjectScale: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(updated problems and command group)
m (Some wiki formatting)
(16 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command
{{RV|type=command


|game1= arma3dev |Game name=
|game1= arma3
|version1= 2.02


|version= 2.01 |Game version=
|arg= local


|arg= |Multiplayer Arguments ("local" or "global")=
|eff= global


|eff=  |Multiplayer Effects ("local" or "global")=
|gr1= Object Manipulation


|serverExec= |Multiplayer Execution ("server" or empty)=
|descr= Scales an [[attachTo|attached object]] or a [[Arma_3_Simple_Objects|Simple Object]]'s model.


|gr1= Object Manipulation |GROUP1=
|pr= The {{arma3}} [[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.
 
{{Feature|informative|Setting the scale of non-simple objects, such as vehicles with players/AI in them, static objects ({{hl|simulation {{=}} "house"}} in config), etc. might be possible, but not officially supported. You may encounter issues.}}
 
{{Feature|important|Changing the direction of the object (e.g. using [[setDir]], [[setVectorDir]], etc.) will reset the object back to its original size (probably because the engine normalizes the directions, thus the scale in the transformation matrix becomes 1), so those commands should be run '''before''' resizing the object.}}
 
|s1= object [[setObjectScale]] scale
 
|p1= object: [[Object]] - must be either an [[attachTo|attached object]] or [[Arma 3 Simple Objects|Simple Object]]
 
|p2= scale: [[Number]] - limited to 0.0001 to 65504, relative to the object model's normal scale
 
|r1= [[Nothing]]


|descr= Scales an [[attachTo|attached object]] or a [[Arma_3_Simple_Objects|Simple Object]]'s model scale. |Description=
|x1= <sqf>
_mrap attachTo [player,[0,0,0]];
_mrap setObjectScale 0.1;
</sqf>


|mp= |Multiplayer Behaviour=
|x2= <sqf>
// select an object in Eden Editor and execute the following code in the Arma 3: Debug Console. When moving the object, the effect is reset!
(get3DENSelected "Object" # 0) setObjectScale 0.1;
</sqf>


|pr= The {{arma3}} [[LOD]] limits still apply, meaning walk-able surfaces can only be X m in size, and collision in general will only work up to X m from object center.
|seealso= [[getObjectScale]]
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.
}}
Setting the scale of actively simulated objects (Vehicles with players/AI in them) is possible, but not officially supported, you may encounter issues. |Problems=
____________________________________________________________________________________________


|s1= object [[setObjectScale]] scale |Syntax=
{{Note
|user= Waffle SS.
|timestamp= 20211223062941
|text= For those interested in the extra cursed, you can scale non-simple objects by running the command every frame.
The multiplayer performance of this is likely terrible.
<sqf>
addMissionEventHandler ["EachFrame", {
{
if (_x != player) then { _x setObjectScale 0.5; };
} forEach allUnits;
}];
</sqf>
}}


|p1= object: [[Object]] - Must be either an attached object or Simple Object |Parameter 1=
{{Note
|user= P1ker1
|timestamp= 20220104221733
|text= Note that
<sqf>_obj setObjectScale 2;</sqf>
doubles the scale factor of an object, not the volume. In the case of a cube this would be the length of an edge.<br>If you want to multiply the volume, raise the ''scale'' to the power of 1/3.<br>
<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])];


|p2= scale: [[Number]] - Limited to 0.0001 to 65504, relative to the object model's normal scale |Parameter 2=
// Double the side length. V=2^3=8
____________________________________________________________________________________________
_cube1 setObjectScale 2;


|x1= <code>_mrap [[attachTo]] <nowiki>[</nowiki>[[player]],[0,0,0]];
// Octuple(8x) the volume. V=(8^(1/3))^3=8
_mrap [[setObjectScale]] 0.1;</code> |Example 1=
_cube2 setObjectScale 8^(1/3);
____________________________________________________________________________________________


|seealso= [[getObjectScale]] |See Also=
// Double the volume.      V=(2^(1/3))^3=2
_cube3 setObjectScale 2^(1/3);
</sqf>
}}
}}

Revision as of 15:05, 27 September 2022

Hover & click on the images for description

Description

Description:
Scales an attached object or a Simple Object's model.
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.
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.
Changing the direction of the object (e.g. using setDir, setVectorDir, etc.) will reset the object back to its original size (probably because the engine normalizes the directions, thus the scale in the transformation matrix becomes 1), so those commands should be run before resizing the object.
Groups:
Object Manipulation

Syntax

Syntax:
object setObjectScale scale
Parameters:
object: Object - must be either an attached object or Simple Object
scale: Number - limited to 0.0001 to 65504, relative to the object model's normal scale
Return Value:
Nothing

Examples

Example 1:
_mrap attachTo [player,[0,0,0]]; _mrap setObjectScale 0.1;
Example 2:
// select an object in Eden Editor and execute the following code in the Arma 3: Debug Console. When moving the object, the effect is reset! (get3DENSelected "Object" # 0) setObjectScale 0.1;

Additional Information

See also:
getObjectScale

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
Waffle SS. - c
Posted on Dec 23, 2021 - 06:29 (UTC)
For those interested in the extra cursed, you can scale non-simple objects by running the command every frame. The multiplayer performance of this is likely terrible.
addMissionEventHandler ["EachFrame", { { if (_x != player) then { _x setObjectScale 0.5; }; } forEach allUnits; }];
P1ker1 - c
Posted on Jan 04, 2022 - 22:17 (UTC)
Note that
_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.
// 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);