This is what I have so far, if there is something being used incorrectly of something or something isn't right let me know.
Script.target = "" --entity "target"
Script.Range = 2.0 --float "Range"
Script.MinNormal = 45 --float "Min Normal"
Script.MaxNormal = 120 --float "Max Normal"
function Script:Start()
end
function Script:UpdateWorld()
local pickInfo = PickInfo()
local castPos = pickInfo.position
local NormalInfo = pickInfo.normal
local playerPos = self.target:GetPosition(true)
System:Print(castPos:DistanceToPoint(playerPos) <= self.Range)
--Is the player within the range?
if(castPos:DistanceToPoint(playerPos) <= self.Range) then
local point2 = Transform:Point(0,0,self.Range, self.entity, nil)
if(self.entity.world:Pick(castPos, point2, pickInfo, 0, true)) then
if (NormalInfo >= MinNormal and NormalInfo <= MaxNormal) then
--set or call something here.
end
end
end
end