Ent, physgun beam uncorrect

so my problem is that when i take the entity with my physgun and move the ent around the physgun beam don’t move with the ent. when i grab it with the gravity gun and then with the physgun it’s just magically works

http://www.bizen.dk/lol1.jpg

http://www.bizen.dk/lol2.jpg

http://www.bizen.dk/lol3.jpg

[lua]
/---------------------------------------------------------
Todo:
Make a code for AcceptInput hook
---------------------------------------------------------
/

ENT.Type = “anim”
ENT.Base = “prop_physics”

ENT.PrintName = “Health Vial New”
ENT.Author = “”
ENT.Contact = “”

ENT.Spawnable = false
ENT.AdminSpawnable = true
ENT.RenderGroup = RENDERGROUP_OPAQUE

AddCSLuaFile( “shared.lua” )

/---------------------------------------------------------
Name: Initialize
---------------------------------------------------------
/
function ENT:Initialize()
self:SetModel(“models/healthvial.mdl”)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
end

function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local ent = ents.Create( self.Classname )
ent:SetPos( tr.HitPos + tr.HitNormal * 16 )
ent:SetAngles(ply:GetAngles())
ent:Spawn()
ent:Activate()

phys = ent:GetPhysicsObject()
if phys and phys:IsValid() then phys:Wake() end

return ent

end

function ENT:AcceptInput( Name, Activator, Caller )
if Name != “Use” and Caller:IsPlayer() then return end
end

if(CLIENT)then
function ENT:Draw()
self.Entity:DrawModel()
end
end
[/lua]

Initialize the model and the physics only serverside.
[lua]
function ENT:Initialize()
if SERVER then
self:SetModel(“models/healthvial.mdl”)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
end
end
[/lua]

nvm mind, working now… i moved ENT:Initialize() and ENT:SpawnFunction server side instead of shared

[editline]21st March 2011[/editline]

rolf