Entity model is not working correctly.

So I have my entity model as a ragdoll. but when it spawn it is in the T pose with the arms out. Any ideas on how to fix this and maybe even put an animation so that it turns its head?

  • Thanks!

I’ve heard that they need to be set up to rag, but not sure on that.

Are you creating a prop_ragdoll, setting the model, etc… Spawning and Activating /Phys-waking them?

Here’s how I do it

// Spawn a serverside ragdoll, setup data for revive, etc.. and copy bone positions over - Josh 'Acecool' Moser
function GM:CreateRagdoll( _victim )
	local _ragdoll = ents.Create( "prop_ragdoll" );
	_ragdoll:SetPos( _victim:GetPos( ) );
	_ragdoll:SetModel( _victim:GetModel( ) );
	_ragdoll:SetAngles( _victim:GetAngles( ) );
	_ragdoll:SetColor( table.Copy( _victim:GetColor( ) ) );
	_ragdoll:Spawn( );
	_ragdoll:Activate( );


	// Set values for the ragdoll to remember
	_ragdoll:SetFlag( "owner", _victim:GetID( ) );
	_ragdoll:SetFlag( "ownersteam", _victim:SteamID( ) );
	_ragdoll:SetFlag( "deathtime", CurTime( ) );

	// Link it to the player
	_victim:SetFlag( "ragdoll", _ragdoll:GetID( ), true );

	// Copy player bone positions to the ragdoll so it appears as though the player falls from where the character stood
	_ragdoll:TransferBonePositions( _victim, _ragdoll );

	return _ragdoll;

Where do I put that? And how does it all work?

Here’s the code I have:

function ENT:Initialize()
	self:SetHealth( 100 )
	self:SetModel( 'models/nypd/male_09.mdl' )
	self:SetSolid( 2 )
	self:SetMoveType( MOVETYPE_VPHYSICS )
	self:SetUseType( SIMPLE_USE )
	local phys = self:GetPhysicsObject()
	if ( phys:IsValid() ) then


There is already an entity specifically designed for this. If you create a new entity, I’m pretty sure you’d need to set up the automatic frame advance / animation system, etc… Why not just use a pre-existing entity, and if you need to be able to target it ( I use DEBRIS TRIGGER which lets a user target it ), you can add a hook to detect use…

Or… Are you trying to create a ragdoll such as a body on death, or are you trying to make a ragdoll model into an npc that can be interacted with or are you trying to make a shop type npc???

You say you want a ragdoll, but you want it to turn its head?

Here’s an example of a npc ( which can turn its head ) that when you use it, it’ll open a vgui panel on the client with 2 buttons.

That example is exactly what i’m trying to make. I have a dpanel already I just need the Npc.

I am getting an error. SetHullType is a nil value.