Copying existing ragdoll positions onto a new ragdoll?

Hi guys,

so for a while I’ve been trying to work out how to create client ragdolls with the same bone positions as another ragdoll, however I am really rather unsure how to do this given every one of my attempts has failed.
I have a list of modifiable bones as follows:
[lua]local skeleton = {

and I then store the positions of these bones in a table so I can use this table to set the bone positions of another ragdoll later, similar to this:


local bones = {}

for i, bone in pairs(skeleton) do
local boneTable = {}
local boneIndex = plr:LookupBone(bone)
boneTable.index = boneIndex
boneTable.pos = plr:GetManipulateBonePosition(boneIndex)
boneTable.ang = plr:GetManipulateBoneAngles(boneIndex)

SetBonePosition unfortunately seems extremely buggy and I have been unable to get it to work at all, giving me all this “bone unwritable” rubbish.
This simply makes the skeleton T pose, presumably because the bones have not been “manipulated” but this function is the only way I am able to reliably change the bone positions.

Is there some function I’ve missed that will let me get the actual bone positions for use with ManipulateBonePositions/Angles?

Take a look at TTT, corpse.lua on the Create segment. It shows how to copy exact bones from the player to entity to give the appearance of player falling over.