Garry's Mod Wiki

Revision Difference

Entity:Activate#515651

<function name="Activate" parent="Entity" type="classfunc">⤶ <description>⤶ Activates the entity. This needs to be used on some entities (like constraints) after being spawned.⤶ ⤶ <note>For some entity types when this function is used after <page>Entity:SetModelScale</page>, the physics object will be recreated with the new scale. [Source-sdk-2013](https://github.com/ValveSoftware/source-sdk-2013/blob/55ed12f8d1eb6887d348be03aee5573d44177ffb/mp/src/game/server/baseanimating.cpp#L321-L327)</note>⤶ <bug issue="3372">This crashes the game with scaled vehicles.</bug>⤶ </description>⤶ <realm>Shared</realm>⤶ </function>⤶ ⤶ <example>⤶ <description>Spawns a 'sent_ball' on the player.</description>⤶ <code>⤶ function ENT:SpawnMe(ply)⤶ local SpawningPos = ply:GetPos()⤶ local ent = ents.Create("sent_ball")⤶ ent:SetPos( SpawningPos ) ⤶ ent:Spawn()⤶ ent:Activate()⤶ end⤶ </code>⤶ ⤶ </example>