Revision Difference
Global.ClientsideModel#529368
<function name="ClientsideModel" parent="Global" type="libraryfunc">
<description>
Creates a non physical entity that only exists on the client. See also <page>ents.CreateClientProp</page>.
<bug issue="861">Parented clientside models will become detached if the parent entity leaves the PVS.</bug>
<bug issue="1387">Clientside entities are not garbage-collected, thus you must store a reference to the object and call <page>CSEnt:Remove</page> manually.</bug>
<bug issue="3184">Clientside models will occasionally delete themselves during high server lag.</bug>
</description>
<realm>Client</realm>
<args>
<arg name="model" type="string">The file path to the model.
<warning>Model must be precached with <page>util.PrecacheModel</page> on the server before usage.</warning></arg>
<arg name="renderGroup" type="number" default="RENDERGROUP_OTHER">The render group of the entity for the clientside leaf system, see <page>Enums/RENDERGROUP</page>.</arg>
</args>
<rets>
<ret name="" type="CSEnt">Created client-side model. ( C_BaseFlex )</ret>
</rets>
</function>
⤶
⤶
⤶
<example>⤶
<description>Creates a clientside entity where the player is looking.</description>⤶
<code>⤶
concommand.Add( "test_csent", function( ply )⤶
local plyTr = ply:GetEyeTrace()⤶
⤶
csEnt = ClientsideModel( "models/props_c17/oildrum001_explosive.mdl" )⤶
csEnt:SetPos( plyTr.HitPos + plyTr.HitNormal * 24 )⤶
csEnt:Spawn()⤶
end )⤶
</code>⤶
</example>