ClientsideModel
Description
Creates a non physical entity that only exists on the client. See also ents.CreateClientProp.
Parented clientside models will become detached if the parent entity leaves the PVS. A workaround is available on its github page.
Issue Tracker: 861
Issue Tracker: 861
Clientside entities are not garbage-collected, thus you must store a reference to the object and call CSEnt:Remove manually. To workaround this bug, you need to hold a reference (in a variable) to the entity and remove it when necessary.
Issue Tracker: 1387
Issue Tracker: 1387
Arguments
1 string model
The file path to the model.
Model must be precached with util.PrecacheModel on the server before usage.
2 number renderGroup = RENDERGROUP_OTHER
The render group of the entity for the clientside leaf system, see Enums/RENDERGROUP.
Returns
Example
Creates a clientside entity where the player is looking.
local entity
concommand.Add( "test_csent", function( ply )
local trace = ply:GetEyeTrace()
entity = ClientsideModel( "models/props_c17/oildrum001_explosive.mdl" )
entity:SetPos( trace.HitPos + trace.HitNormal * 24 )
entity:Spawn()
end )