impassDummy = CreateDummySprite()
treeDummy = CreateDummySprite()
roughDummy = CreateDummySprite()
waterDummy = CreateDummySprite()
SetSpritePhysicsOn( impassDummy,1 )
SetSpritePhysicsOn( treeDummy,1 )
SetSpritePhysicsOn( roughDummy,1 )
SetSpritePhysicsOn( waterDummy,1 )
SetSpriteCategoryBits( impassDummy,Block )
SetSpriteCategoryBits( treeDummy,Block )
SetSpriteCategoryBits( roughDummy,NoBlock )
SetSpriteCategoryBits( waterDummy,NoBlock )
function LOSblocked(x1,y1,x2,y2)
if PhysicsRayCastCategory(Block,x1,y1,x2,y2)
if VectorDistance(x1,y1,x2,y2) > DLS then exitfunction True else exitfunction False `adjacent nodes are always in LOS
endif
endfunction False
function ShowRayCast()
n = GetObjectRayCastNumHits()
print("GetObjectRayCastNumHits "+str(n))
for i = 0 to n - 1
obj = GetObjectRayCastHitID()
print("Object ID: "+str(obj))
next
endfunction
The problem seems to be the same whether its 2D or 3D. The documentation says that the shape a ray cast originates from is not included in the hit results.