Hello guys! I need some help with raycasting. scene is very simple have cube (player) and the wall (player is set to Character collision type and wall is set to debris). down bellow scene picture.
Here is the code
if window:MouseDown(Key.LButton) then
local pickInfo = PickInfo()
local point1 = self.entity:GetPosition()
local point2 = self.rayWall:GetPosition()--Transform:Point(0,0,1000, self.rayWall,nil)
if self.entity.world:Pick(point1, point2, pickInfo, 0, true, Collision.Prop) then
System:Print("Picked!!!")
end
end
so there are problem in output 'Picked!!!' should come up when ray hits the wall, but 'Picked!!' comes when I click anywhere.
P.S.I'am new at this game engine and LUA scripting. And not sure how raycasting works.
Thanks