it's not giving any error's or anything not sure why it's not printing out, I must be doing something wrong, I know I am close enough, not sure about the normal's part if it is even detecting the object's,
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 window = Window:GetCurrent()
local pickInfo = PickInfo()
local castPos = pickInfo.position
local playerPos = self.target:GetPosition(true)
--System:Print(string(castPos:DistanceToPoint(playerPos) <= self.Range))
--Is the player within the range?
if(castPos:DistanceToPoint(playerPos) <= self.Range) then
if(window:KeyDown(Key.Space)) then
local NormalInfo = pickInfo.normal
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
System:Print("Dected proper")
--set or call something here.
end
end end
end
end
Thought's?