I’m having trouble keeping a static physics body on the screen at all times. I am moving my “world” display group in order to follow my player. I add the static physics body and it works until my player reaches past the edge of the screen. then I will go through the bottom of the screen. I’ve tried physics debug mode to see where the collisions are happening… but I do see my bottom physics body at all times. I’m just travelling through it for some reason.
adding bottom (my player collides with this until i travel too far to the right)
local bottom = display.newRect( 0, screenH - 2, screenW, 2 ) bottom.anchorX, bottom.anchorY = 0,0 sceneGroup:insert( bottom ) physics.addBody( bottom, 'static' )
moving my player to the right
function screenTouched(e) if e.phase == 'began' then player.obj:setLinearVelocity( 50, -100 ) end end
moving my world according to the players position. my player is within the world group
function update( ) local target = -player.obj.x + 100 world.x = world.x + (target - world.x) \* 0.05 end