Entity doesn't stick to player well

Basically, I parent a prop to a player and set its position to a player’s attachment. Everything’s good so far, but when I move too fast, this happens:
The attached prop doesn’t completely follow the player…


Is it “lagging” behind or does it simply not keep the position it should?

More “lagging”, as it DOES follow the player but with a small delay or similiar.

You need to update it clientside, in ENT:Draw() too.

I’ve seen it on every server, no matter if it was drawn on the client, it always lags.

It’s just something that happens in GMod, and until it’s fixed, I guess you have to deal with it?

I personally hate it, but not much you can do.

I just told you how to fix it, and yes there is much you can do. Look at tiramisu, it doesn’t have this.

I am using SENTs and I am drawing them on the client. No lagging at all.

Hm, UnderDone uses Ent.DRAW and it still lags, I’m pretty sure its more dependent on the server and the client, rather than the code.

People need to use ent:SetRenderOrigin inside ENT:Draw() instead ent:SetPos which causes the visual lag as the op reported.
Also,the normal source engine parenting does uses ent:SetPos,so Wolfo,if you are using it then it may be good that you draw your clientside models yourself on the PostPlayerDraw hook and position them with ent:SetRenderOrigin(vec).

So wait, should I draw the model clientside in PostPlayerDraw with SetRenderOrigin() or use SetRenderOrigin() in ent’s Draw()?
I’ll try both as soon as I can anyway.

Either way works,you only need to use the PostPlayerDraw when the entity doesn’t have a proper draw hook like client side models,but if the entity does you can just use its ent:Draw() method (or drawtranslucent depending on the render group).

Still nothing, I did like Jvs said and replaced SetPos() with SetRenderOrigin() in ENT:Draw() but it still lags… it looks like it lags more than before now :confused:
I’ll try using it in PostPlayerDraw with clientside models.

Post the code…

function ENT:Draw()
local Owner = self:GetOwner()
if Owner:Alive() then
local Attachment = Owner:GetAttachment(Owner:LookupAttachment(“chest”));
local Pos = Attachment.Pos;
local Ang = Attachment.Ang;
self:SetRenderOrigin(Pos + Ang:Right() * -1 +
Ang:Forward() * -12 +
Ang:Up() * -16);
self:SetAngles(Ang + Angle(0, 0, 0));

function ENT:Initialize ( ) self:DrawShadow(false); end


Fixed! Just needed to DrawModel and SetModelScale right after setting RenderOrigin and Angles.