• Getting a SENT to stay behind it's owner.
    3 replies, posted
  • Avatar of BastinkaLive
  • Hey, I was wondering if I'd somehow parent the SENT to the owner or if I just set the position to be behind the owner? Which way, or maybe another way, would be the best? Also, do SENT's have to have models?
  • Avatar of Skyhawk
  • If you want it to be fixed behind the owner... [lua] sent:SetParent(ply) timer.Simple(0.1, function() local forward = ply:GetForward()*-48 sent:SetPos(ply:GetPos + Vector(forward.x, forward.y, 0) end, sent, ply)[/lua] You can replace that 0 with a z offset if you want, but you don't want it to just be ply:GetPos + forward or you'll have vertical weirdness if the player is looking up or down - you might still anyway, I think aVon or some other Lua God would probably be better with vectors.
  • Avatar of Skyhawk
  • [lua]local ang = Angle(0, ply:GetAngles().y, 0) ang = ang:Forward()*-48 sent:SetPos(ply:GetPos + ang)[/lua] Try that code I gave you while looking up and down (run the code to parent the sent while the player is looking up or down) and if the distance behind is different than when looking straight out, replace lines 3 and 4 of what I gave you with this. Actually, try replacing them with this anyway, I think it should be better. [b]Edit:[/b] Oi, screwed it up a bit, should have been Angle(0, ply:GetAngles().y, 0) not Vector(blabla), sorry.