self:SetModelScale() conflicting with GetEyeTrace() ?

Hello, I am trying to make a derma box show up while the player is looking at an entity.


hook.Add("HUDPaint","DrawInfo",function()
	local aimPos = LocalPlayer():GetEyeTrace()
	local playerPos = LocalPlayer():GetPos()
	local dist = playerPos:Distance(aimPos.Entity:GetPos())

	if aimPos.Entity:GetClass() == "paper_blotter" then
		draw.RoundedBox(5, ScrW()/2-103-2.5, ScrH()/2+15-2.5, 205, 125, Color(255,20,0,255))
	end
end)

While this works as is, it will not work after I manually set the scale of the model. I am setting the scale using self:SetModelScale(0.3,0) in my ENT:Initialize function. This seems to be conflicting with LocalPlayer():GetEyeTrace().
Anyone have any ideas as to how this could be fixed, or is it a Garry’s Mod bug?

One suggestion that worked for me was to scale the physics shared.

I’d take a wild guess and say that GetEyeTrace does not take into account view position changes from model scaling. I’d bet same goes for weapons.

To fix it, you gotta do the trace manually, adjusting the start position manually. You can easily do this, the original GetEyeTrace() is a Lua function, you can find its source on GMod’s GitHub, or through the wiki page > Search On Github or “View Source” if available.

I’m lost as to how I should go about doing this. I’m fairly new to glua. How do I manually do the trace?
Like as in call SetModelScale in a different function rather than my Initialize function?

Have you tried Entity:Activate after SetModelScale?