Garry's Mod Wiki

Revision Difference

Entity:SetModelScale#567577

<function name="SetModelScale" parent="Entity" type="classfunc"> <description> Uniformly scales the model of the entity, if the entity is a <page>Player</page> or an <page>NPC</page> the hitboxes will be scaled as well. To resize the entity non-uniformly, along any axis, use <page>Entity:EnableMatrix</page> instead. For some entities (Such as `prop_physics` and `anim` type <page>Scripted Entities</page>), calling <page>Entity:Activate</page> after this will scale the collision bounds and <page>PhysObj</page> as well; be wary as there's no optimization being done internally and highly complex collision models might crash the server. Client-side trace detection seems to mess up if `deltaTime` is set to anything but zero. A very small decimal can be used instead of zero to solve this issue. If your old scales are wrong, use <page>Entity:SetLegacyTransform</page> as a quick fix. <note>If you do not want the physics to be affected by <page>Entity:Activate</page>, you can use <page>Entity:ManipulateBoneScale</page>`( 0, Vector( scale, scale, scale ) )` instead.</note> ⤶ <bug issue="6405"> On the client, `anim` types' collision testing prediction fails for changed model scales: you can use `cl_showerror 2` to see by how much. Essentially, the client will freak out when you stand/run past on a Scripted Entity or prop that has been modified using this method. </bug> ⤶ <validate>This disables IK.</validate> </description> <realm>Shared</realm> <args> <arg name="scale" type="number">A float to scale the model by. 0 will not draw anything. A number less than 0 will draw the model inverted.</arg> <arg name="deltaTime" type="number" default="0">Transition time of the scale change, set to 0 to modify the scale right away. To avoid issues with client-side trace detection this must be set, and can be an extremely low number to mimic a value of 0 such as .000001.</arg> </args> </function> <example> <description>From the "Biggify" option of right clicking an npc</description> <code>ent:SetModelScale( ent:GetModelScale() * 1.25, 1 )</code> </example>