1, Have you verified the position of the body by using hybrid draw mode? If not,please do. It seems fine to me:
local physics = require "physics" physics.start() physics.setGravity(0,0) physics.setDrawMode('hybrid') -- \<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\< Always do this to validate body position local points = { 100, 100, 200, 100} local myLine = display.newLine( unpack(points) ) myLine:setStrokeColor(1.0, 0.0, 0.0) myLine.strokeWidth = 2 physics.addBody(myLine, "static", { friction = 0.0, bounce = 0.0, isSensor = true })
2.Even if the body is in the right place, a thin body like that is going to cause you troubles because it is highly susceptible to tunneling.
** UPDATE: This may not be true any longer. I suspect lines automatically use a chain body. **
- You shouldn’t really be adding ‘generic’ bodies to lines, whether they worked for you before or not. This is not the intended usage of lines and a common mistake.
** UPDATE: May be moot (see my post below) **
4. However, you can add a chain style body:
https://docs.coronalabs.com/guide/physics/physicsBodies/index.html#edge-shape-chain-body
local physics = require "physics" physics.start() physics.setGravity(0,0) physics.setDrawMode('hybrid') local points = { 100, 100, 150, 150, 200, 100} local points2 = { 0, 0, 50, 50, 100, 0} local myLine = display.newLine( unpack(points) ) myLine:setStrokeColor(1.0, 0.0, 0.0) myLine.strokeWidth = 2 physics.addBody( myLine, "static", { chain= points2, connectFirstAndLastChainVertex = false, friction = 0.0, bounce = 0.0, isSensor = true } )