Garry's Mod Wiki

Revision Difference

Global.ClientsideRagdoll#561463

<function name="ClientsideRagdoll" parent="Global" type="libraryfunc"> <description> Creates a fully clientside ragdoll. <note>The ragdoll initially starts as hidden and with shadows disabled, see the example for how to enable it. There's no need to call <page>Entity:Spawn</page> on this entity.⤶ The Physics won't initialize at all if the model hasn't been precached or spawned serverside first on x86-64 (x86-64 does not use dynamic model indexes whereas main branch does).</note>⤶ There's no need to call <page>Entity:Spawn</page> on this entity.</note>⤶ <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> </description> <realm>Client</realm> <args> <arg name="model" type="string">The file path to the model.</arg> <arg name="renderGroup" type="number" default="RENDERGROUP_OPAQUE">The <page>Enums/RENDERGROUP</page> to assign.</arg> </args> <rets> <ret name="" type="CSEnt">The newly created client-side ragdoll. ( C_ClientRagdoll )</ret> <ret name="" type="CSEnt">The newly created client-side only ragdoll. (`C_ClientRagdoll`)</ret> </rets> </function> <example> <description>Creates a new ragdoll with the player model of breen and enables rendering and shadows.</description> <code> local ragdoll = ClientsideRagdoll( "models/player/breen.mdl" ) ragdoll:SetNoDraw( false ) ragdoll:DrawShadow( true ) concommand.Add( "test_csragdoll", function( ply ) ⤶ local ragdoll = ClientsideRagdoll( "models/player/breen.mdl" ) ragdoll:SetNoDraw( false ) ragdoll:DrawShadow( true )⤶ --print( ragdoll )⤶ ⤶ end )⤶ </code> </example>