castRayDebug
Definition
-- @/lua/ge/ge_utils.lua:1298
-- same as castRay, but with debug drawing
function castRayDebug(origin, target, includeTerrain, renderGeometry)
if includeTerrain == nil then includeTerrain = false end
if renderGeometry == nil then renderGeometry = false end
-- ray line
debugDrawer:drawSphere(origin, 0.1, ColorF(1,0,0,1))
debugDrawer:drawSphere(target, 0.1, ColorF(0,0,1,1))
local res = castRay(origin, target, includeTerrain, renderGeometry)
-- the ray line
local col = ColorF(0,1,0,1)
if not res then col = ColorF(1,0,0,1) end
debugDrawer:drawLine(origin, target, col)
if not res then return end
-- draw the collision and the normal of it
debugDrawer:drawSphere(res.pt, 0.1, ColorF(0,1,0,1))
debugDrawer:drawLine(res.pt, (res.pt + res.norm), col)
return res
end
Callers
@/lua/ge/ge_utils.lua
local b = vec3(4 + math.cos(castRayTest) * 3,-2+math.sin(castRayTest) * 3,-10)
castRayDebug(a, b, false, false)
end