Collision with group objects

I am creating a game in which a player moves left and right to avoid obstacles. For some reason the collision event is triggered only when two of the same types of objects collide (a player and a player, an obstacle and an obstacle). I have tried many different things and nothing seems to work. Is there something wrong with the scope, if so how can I fix it? I am very confused, Thank You.

I have a player object:

function newPlayer( )

local self= display.newImage( “rocket.png”,screenWidth/2, screenHeight/1.25 )

local image_outline = graphics.newOutline( 2, “rocket.png” )

physics.addBody( self, “dynamic”,{
outline=image_outline , density=1.0, friction= 0.3, bounce= 0.02} )
self.isSleepingAllowed= false

–more code in player object but thats all that is needed for this question

end

An object function that creates a pair of rectangles and adds them to the overall obstacle group:

slalom= display.newGroup()

local leftWall= display.newRect( start-screenWidth/2, 0, screenWidth, 50 )
physics.addBody( leftWall, “static”, {density=10,friction=0.2,bounce=.01} )

local rightWall= display.newRect( leftWall.x+(screenWidth)+width, 0, screenWidth, 50 )
physics.addBody( rightWall, “static”, {density=10,friction=0.2,bounce=.01} )

slalom:insert( leftWall )
slalom:insert( rightWall )
self:insert(slalom)

I create a runtime listener to sense collision:

Runtime:addEventListener(“collision”, onCrash)

One issue is that all objects have to be in the same parent display group.

The rocket doesn’t seem to be added to any dispay group, and slalom seems to be inserted to ‘self’, although I can’t tell what that is from this code.

Did you scale or move any of the display groups?  The display groups need to me moved and scaled together for the physics objects to work properly.

One issue is that all objects have to be in the same parent display group.

The rocket doesn’t seem to be added to any dispay group, and slalom seems to be inserted to ‘self’, although I can’t tell what that is from this code.

Did you scale or move any of the display groups?  The display groups need to me moved and scaled together for the physics objects to work properly.