Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
raycast get the closest point — Gideros Forum

raycast get the closest point

duke2017duke2017 Member
edited November 2012 in General questions
I want to draw a beam of light that goes from point A to point B. But if the point falls between the object, the beam rests on him. My problem is that if between points A and B are two figures, оr more, the nearest to the source is ignored and the beam passing through it, rests in the far. I heard that handles raycast figures from far, but how to make raycast skip far?

function ray1(fixture, hitX, hitY, vectX, vectY, fraction)
if fixture ~= nil then
bodyf = fixture:getBody()
levelSelf.hity = hitY
end
end

function rayofball1(x,y)
levelSelf.ray1 = levelSelf.world:rayCast(x, y, x, 9, ray1)
if levelSelf.hity ~= nil then
levelSelf.lazer = Lazer(x, y, x, levelSelf.hity)
levelSelf:addChild(levelSelf.lazer)
end
end
Tagged:

Comments

Sign In or Register to comment.