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
Comments
https://play.google.com/store/apps/details?id=com.uglygames.slug
first 30, second 150 ==> first hitY=30 fraction 0.89, second hitY=49.49 fraction 1...
or its bug, or its feature?
https://play.google.com/store/apps/details?id=com.uglygames.slug
https://play.google.com/store/apps/details?id=com.uglygames.slug
https://play.google.com/store/apps/details?id=com.uglygames.slug