GetBoneMatrix is retarded and gives out wrong matrices

That, or there is some weird ass problem with BuildBonePositions. Here is the code.

[lua]concommand.Add(“modeltest”, function()
PModel = ClientsideModel(LocalPlayer():GetModel())
PModel:SetPos(LocalPlayer():GetPos())
PModel:SetAngles(LocalPlayer():GetAngles())
PModel:SetParent(LocalPlayer())
function PModel:BuildBonePositions(NumBones)
LocalPlayer():SetupBones()
for i=0,NumBones-1 do
local m = LocalPlayer():GetBoneMatrix(i)
if m then
self:SetBoneMatrix(i, m)
end
end
end
end)[/lua]

Could not be simpler, it’s a console command that creates a clientside model which mimics any movement the playermodel does. Body parts follow properly, but when it comes to the head, fingers and toes, it fucks up completely.

http://uppix.net/0/c/4/bf359a0b7901d0f95ddfaf865773e.jpg

I applied the wireframe material to myself, so you can see the difference with the “simulated” model.

So either I’m retarded and did something completely wrong, the function itself is screwed up and I’ll have to ask Garry about that.
It’s driving me crazy, and I have absolutely no idea how to fix that.

Anyone has a clue?

Also, please don’t suggest alternative solutions that involve playing animations, I really need to use bone matrices because that’s the only solution.

I’ve had this problem too, it’s rather annoying to say the least. A good solution for it would either A) fix this or B) implement the bone merge effect ( AddEffects(EF_BONEMERGE) ).

Okay, so I guess I’ll have to find a way to stick this into Garry’s face so he doesn’t ignore it this time. :argh:
I’m pretty much sure that’s also the reason why jigglebones are screwed up.