I’m trying to create a non-moving, fully cloned ragdoll of a player’s position and angles.
Here’s what I tried:
[lua]
local ply = Entity(1)
local rag = ents.Create(“prop_physics”)
rag:SetModel(Entity(1):GetModel())
– rag:SetPos(Entity(1):GetPos())
rag:SetKeyValue( “origin”, ply:GetPos().x … " " … ply:GetPos().y … " " … ply:GetPos().z )
rag:SetAngles(Entity(1):GetAngles())
rag:SetSolid(SOLID_NONE)
rag:Spawn()
rag:Activate()
rag:SetMoveType(MOVETYPE_NONE)
rag:SetCollisionGroup(COLLISION_GROUP_WEAPON)
local phys = rag:GetPhysicsObject()
if IsValid(phys) then
phys:EnableMotion(false)
phys:EnableGravity(false)
end
[/lua]
The torso holds still, but the rest of the body slumps down from T-Pose when it spawns.
Should I loop through all the bones, disabling motion and setting their angles?
What do you think I need to do?
If all else fails I was thinking I could just gesture the player into T-Pose and then spawn a ragdoll in T-Pose to sync it.
Another option I considered was to make a nextbot and set the model to the players and set the same animation sequence that the player was doing, but I want to avoid this because I think it would lag the server.
Thanks for your help.