Hello there.
I'm trying to render a client side model upon dying to make something like this:
https://files.facepunch.com/forum/upload/113353/bf08d2ad-47f2-4c04-af58-d4cc3b205dd0/imagen.png
(I've already made so the camera is in "first person" - not stuck to the ragdoll - and sideways)
However, I'm having the issue that when the player dies, the model stucks in place, meaning that if a player dies in the air, the camera will fall, but the model will stay in place.
Is there any way to make the model follow the player?
Current code testing this out:
local model;
local function generateModel()
if (model == nil) then
model = ClientsideModel("models/weapons/v_grenade.mdl", RENDERGROUP_VIEWMODEL);
end
end
hook.Add("PostDrawOpaqueRenderables", "cofhud_death_hand", function(viewModel, player, weapon)
local ang = LocalPlayer():EyeAngles();
generateModel();
model:SetPos(LocalPlayer():EyePos());
model:SetAngles(Angle(0, ang.y, ang.r));
model:ManipulateBonePosition(0, Vector(13, 5, -40));
model:ManipulateBoneAngles( 2 , Angle(0, -60, -80) );
-- model:ManipulateBoneScale(0, Vector(0, 0, 0));
end);
Depends on if you are changing the players eyepos to something else or just moving his view. In that case, the model is probably positioned at the old eyepos and your view will be away, so you are going to take that into consideration.
Now that you say it, maybe I can find a solution utilizing the CalcView hook.
I'll try it and report back.
Sorry, you need to Log In to post a reply to this thread.