Ground stops having physical effect over certain distance.

I’ve made a simple video to demonstrate:
YouTube Video

Basically, I’ve made the ground by doing:

display.newLine(0, display.contentHeight, display.contentWidth, display.contentHeight)

and set it as a static physical object. Only problem is that only about half of it is actually becoming physical, the whole right hand side seems to let the “lulz” fly straight past it. Why is this happening? [import]uid: 30068 topic_id: 6160 reply_id: 306160[/import]

How wide will the ground be when you run it on your iPad?

Try adding a ground with a smaller fixed size like 800 pixels and move that from x=0 and then try to move it like x.300 to see if the lulz will fly right through it as well or bounce.

There seem to be some bug or missing feature is using physical objects that is large [import]uid: 22737 topic_id: 6160 reply_id: 21158[/import]

i’ve added a bug: http://developer.anscamobile.com/forum/2011/02/07/windows-displaynewline-doesnt-show-even-y-pixel-also-physics-body-wrong

however i’m not sure you’re meant to add physics to a line. (just because you can doesn’t mean you should!)

i would try making a rect with height of 1 or 2 etc and see if that fixes it
[import]uid: 6645 topic_id: 6160 reply_id: 21211[/import]

try adding the “hybrid” physics code so you can see exactly whats giong on, i had the same problem. i would create a line and make it a static object, and the objects “static” body was shifted half way to the side of my actual line object, seems like a bug to me [import]uid: 19620 topic_id: 6160 reply_id: 21333[/import]

use a rect with height of 1
[lua]ground=display.newRect(0,display.contentHeight-4,display.contentWidth,1)
ground:setFillColor(255,0,0)
physics.addBody(ground,“static”)[/lua] [import]uid: 6645 topic_id: 6160 reply_id: 21514[/import]

hey
I am reading but how the heck can I use statics object even with isSensor=true to report collision events though not be moved when hit by other objects?

I have tried to make the stick a rectangle as you mentioned but still it did not help.
[lua]–> ninja stars
local gameUI = require(“gameUI”)

–> Add Physics
local physics = require( “physics” )
physics.start()
physics.setGravity(0, 0)

–> Hide the status bar
display.setStatusBar(display.HiddenStatusBar)

–> Adds a background image
local background = display.newImage( “images/background.png” )

–> bamboostick
local stick = display.newImage( “images/stick.png” )
stick.x = 50
stick.y = 150
physics.addBody( stick ,{})
stick.name = “stick”

–> score stuff
score = require (“score”)
local scoreInfo = score.getInfo()

score.init({
x = 0,
y = 0}
)
score.setScore(0)

–> function to drag
function dragBody( event )
– I have tweaked the gameUI dragBody event so it does not move in x position only y
gameUI.dragBody( event, { maxForce=20000, frequency=10, dampingRatio=0.2, center=true } ) – very tight dragging, snaps to object center
end

–> Function to randomly spawn crates
local randomCrate = function()
local crate
crate = display.newImage( “images/superninja.png” )
crate.x = 200 + math.random(230)
crate.y = 400
crate.name = “ninja”
local crateTrans = transition.to(crate, { time=math.random(500,1000), alpha=1 ,x=crate.x, y=(math.random(300)),onComplete=fireStar})
local function killMe(dudeToKill)
dudeToKill:removeSelf()
end

function fireStar(obj)
print(“FIRE!”)
local dude = display.newImageRect(“images/ninjastar1.png”,16,16)
physics.addBody( dude, { bounce=0} )
dude.x, dude.y = obj.x,obj.y
transition.to(dude, {time=math.random(500,2000), x=0, rotation=-360,onComplete=killMe})
local crateTrans = transition.to(obj, { time=math.random(500,1000), xScale=obj.xScale/2, yScale=obj.yScale/2, alpha=0 ,x=obj.x, y=500,onComplete=ninjeHide})
ninjaHide = function()
print( “Ninja gone!” )
end
end

function crate:tap( event )
print(event.target.name)
score.setScore (score.getScore()+event.target.score)
event.target:removeEventListener( “tap”, crate )
event.target:removeSelf()
end

crate:addEventListener( “tap”, crate )

end

local function onCollision(event )
if ( event.phase == “began” ) then
print(event.object1.name … " started")
elseif ( event.phase == “ended” ) then
print(event.object1.name … " ended" )
end
end

stick:addEventListener( “touch”, dragBody )

Runtime:addEventListener( “collision”, onCollision )

–> Make 100 ninjas jump up with 1000 milliseconds in between
timer.performWithDelay( 1000, randomCrate, 100 )[/lua] [import]uid: 22737 topic_id: 6160 reply_id: 21555[/import]