if self.target==nil then return end
if hoverplayer ~= 1 then
self.distance = 0.8
self.pickradius = 0.2
local originalcamerapos = self.entity:GetPosition(true)
local targetpos = self.target:GetPosition(true)
local newcamerapos = self.target:GetPosition(true)
targetpos.y = targetpos.y+camheight
self.entity:SetPosition(targetpos)
self.entity:Move(0.4,0,-self.distance)
local targetpickmode = self.target:GetPickMode()
jill.script.target:SetPickMode(0)
newcamerapos = self.entity:GetPosition()
local pickinfo = PickInfo()
if (self.entity.world:Pick(Vec3(targetpos.x+0.1,targetpos.y,targetpos.z),self.entity:GetPosition(),pickinfo,self.pickradius,true)) then
if pickinfo.entity:GetCollisionType() ~= 4 and pickinfo.entity:GetCollisionType() ~= 0 then
newcamerapos = pickinfo.position
jill.script.target:Hide()
newcamerapos.x = Math:Curve(originalcamerapos.x,newcamerapos.x,100/Time:GetSpeed())
newcamerapos.y = Math:Curve(originalcamerapos.y,newcamerapos.y,100/Time:GetSpeed())
newcamerapos.z = Math:Curve(originalcamerapos.z,newcamerapos.z,100/Time:GetSpeed())
self.entity:SetPosition(newcamerapos)
else
jill.script.target:Show()
end
jill.script.target:SetPickMode(targetpickmode)
end
end