I’m experiencing a bug with the use of the Chain physics body, I made a map with the use of chain for the floor. The problem is the tracer is going through the floor sometimes, shown in this video: http://www.youtube.com/watch?v=kvnf6AxF3WQ

Ill paste the code for the vertices and floor, and the tracer function.

Floor:

```
function changeLevel()
if floor then
for k,v in pairs(floor) do
v:destroy()
v = nil
end
end
levverts = {}
floor = {}
levimg = nil
end
function Level1()
changeLevel()
levimg = readImage("Documents:level1new")
levverts[1] = {vec2(656.25,188),vec2(210.938,188),vec2(210.938,380),vec2(93.75,380),
vec2(93.75,428),vec2(726.562,428),vec2(726.562,740),vec2(187.5,740),vec2(187.5,596),
vec2(164.062,596),vec2(164.062,740),vec2(-281.25,740),vec2(-281.25,476),vec2(-140.625,476),
vec2(-140.625,116),vec2(-164.062,116),vec2(-164.062,452),vec2(-281.25,452),vec2(-281.25,68),
vec2(-304.688,68),vec2(-304.688,740),vec2(-726.562,740),vec2(-726.562,548),vec2(-609.375,548),
vec2(-609.375,524),vec2(-726.562,524),vec2(-726.562,20),vec2(-515.625,20),vec2(-515.625,68),
vec2(-492.188,68),vec2(-492.188,20),vec2(-375,20),vec2(-375,-4.00002),vec2(-492.188,-4.00002),
vec2(-492.188,-28),vec2(-515.625,-28),vec2(-515.625,-4.00002),vec2(-726.562,-4.00002),
vec2(-726.562,-676),vec2(-164.062,-676),vec2(-164.062,-364),vec2(-140.625,-364),
vec2(-140.625,-532),vec2(23.4375,-532),vec2(23.4375,-196),vec2(-281.25,-196),vec2(-281.25,-316),
vec2(-515.625,-316),vec2(-515.625,-532),vec2(-281.25,-532),vec2(-281.25,-556),
vec2(-539.062,-556),vec2(-539.062,-292),vec2(-304.688,-292),vec2(-304.688,20),vec2(-281.25,20),
vec2(-281.25,-52),vec2(23.4375,-52),vec2(23.4375,188),vec2(-46.875,188),vec2(-46.875,572),
vec2(-117.188,572),vec2(-117.188,596),vec2(23.4375,596),vec2(23.4375,572),vec2(-23.4375,572),
vec2(-23.4375,308),vec2(0,308),vec2(0,260),vec2(23.4375,260),vec2(23.4375,212),vec2(46.875,212),
vec2(46.875,-676),vec2(164.062,-676),vec2(164.062,20),vec2(562.5,20),vec2(562.5,-4.00002),
vec2(187.5,-4.00002),vec2(187.5,-172),vec2(281.25,-172),vec2(281.25,-484),vec2(726.562,-484),vec2(726.562,-220),vec2(351.562,-220),vec2(351.562,-172),vec2(656.25,-172),vec2(656.25,188)}
levverts[2] = {vec2(-375,116),vec2(-515.625,116),vec2(-515.625,308),vec2(-632.812,308),
vec2(-632.812,332),vec2(-515.625,332),vec2(-515.625,596),vec2(-375,596),vec2(-375,116)}
for k,v in pairs(levverts) do
floor[k] = physics.body(CHAIN,false,unpack(v))
floor[k].categories = {0}
end
end
function Player:shoot(x,y)
local rb = physics.raycast(self.bl.body.position,self.bl.body.position+vec2(x,y):normalize()*700,1,0)
if rn == nil then return end
if rb and rb.body ~= self.companion then self.laserpoint = rb.point else self.laserpoint = self.bl.body.position+vec2(x,y) end
if not rb then return end
local w,h
if math.abs(rb.normal.x) > 0.5 then
w,h = 0,130
else
w,h = 130,0
end
local rd = physics.raycast(rb.point+rb.normal*5,rb.point+rb.normal*5+vec2(w,h)*0.5,1,0)
local rv = physics.raycast(rb.point+rb.normal*5,rb.point+rb.normal*5+vec2(w,h)*-0.5,1,0)
local rc = physics.raycast(rb.point+rb.normal*5,rb.point+rb.normal*80,1,0)
if self.p1 and self.p1.portal and self.rb.body == self.p1.portal then return end
if self.p2 and self.p2.portal and self.rb.body == self.p2.portal then return end
if rb and not rd and not rv and not rc then
self.port = rb.point
self.normal = rb.normal
end
end
```