rayCast position.y wrong, but only for first object

require(“mobdebug”).start()

require (“physics”)

display.setStatusBar( display.HiddenStatusBar )

physics.start()

local centerX = display.contentCenterX

local centerY = display.contentCenterY

local W = display.contentWidth

local H = display.contentHeight

local l1=display.newLine(40,100,W-40,H*.2)

l1.name=‘line1’

physics.addBody(l1,‘static’)

local l2=display.newLine(40,H*.7,W-40,H*.5)

l2.name=‘line2’

physics.addBody(l2,‘static’)

local l3=display.newLine(40,H*.8,W-40,H*.8)

l3.name=‘line3’

physics.addBody(l3,‘static’)

local hits=physics.rayCast(W/2,0, W/2,H, ‘sorted’)

for i=1, #hits do

  print(hits[i].object.name, hits[i].fraction)

  local c=display.newCircle(hits[i].position.x, hits[i].position.y,4)

  c:setFillColor(0,0,1)

end --for i

on further investigation, the normals were also wrong for the first two lines (0,-1)

tried the same code with thin rectangles and everything worked (position, normals and reflectRay)

on further investigation, the normals were also wrong for the first two lines (0,-1)

tried the same code with thin rectangles and everything worked (position, normals and reflectRay)