collision object problem

Hi everyone,
I’m a corona beginner and I have a problem with my first game.
I have a physic player object(a ball) and I made it collided with
4 physics display object with 4 different shapes (If the ball is colliding with them the game end).
I put the 4 objects in a group in order to translate the group and move these objects at the same time.(the objects are “static”)

In the simulator (with physics.setDrawMode “hybrid”) I see the objects and their shapes moving at the same time… everything looks geate!, but when I collide with the player nothing appen. The player collide just with the starting point of the objects like the were never moved!

note: if I tanslate the blocks one by one everything is fine.
The problem seems to happen when I use and move the group.

Thanks everyone!

here my code:

local blocksGroup1 = display.newGroup()
blocksGroup1.yReference = 0
blocksGroup1.xReference = 0
blocksGroup1.y = 0

–Blocks–
local block1 = display.newImage(“images/block_01.png”,228,64)
block1.name=“block”
block1.x = 150
block1.y = 105
block1Shape = { 90, -15, 90, 15, -90, 15, -90, -15}
physics.addBody( block1, “static”, {density=5.0, friction=0.0, bounce=0.0, shape=block1Shape})
local block2 = display.newImage(“images/block_02.png”,198,318)
block2.name=“block”
block2.x = 75
block2.y = H-180
block2Shape1 = { -45, -15, -75, 15, -75, -135, -45, -135 }
block2Shape2 = { 45, 15, 75, -15, 75, 135, 45, 135 }
block2Shape3 = { 45, 15, -75, 15, -45, -15, 75, -15 }
physics.addBody( block2, “static”, {density=5.0, friction=0.0, bounce=0.0, shape=block2Shape1},
{density=5.0, friction=0.0, bounce=0.0, shape=block2Shape2},
{density=5.0, friction=0.0, bounce=0.0, shape=block2Shape3})
local block3 = display.newImage(“images/block_03.png”,168,168)
block3.name=“block”
block3.x = 240
block3.y = 330
block3Shape = { 60, -60, 60, 60, -60, 60, -60, -60 }
physics.addBody( block3, “static”, {density=5.0, friction=0.0, bounce=0.0, shape=block3Shape})
local block4 = display.newImage(“images/block_04.png”,238,238)
block4.name=“block”
block4.x = W-90
block4.y = H-225
block4Shape1 = { 15, -60, 90, -90, 90, -60 }
block4Shape2 = { -90, -90, 90, -90, 15, -60, -90, -60 }
block4Shape3 = { -15, -60, 15, -60, 15, 90, -15, 90 }
physics.addBody( block4, “static”, {density=5.0, friction=0.0, bounce=0.0, shape=block4Shape1},
{density=5.0, friction=0.0, bounce=0.0, shape=block4Shape2},
{density=5.0, friction=0.0, bounce=0.0, shape=block4Shape3})

local function groupMove(event)
blocksGroup1.y = blocksGroup1.y + blocksSpeed
end
Runtime:addEventListener(“enterFrame”,groupMove)

local playerImg = display.newImage(“images/player.png” ,64,64)
playerImg:setReferencePoint(display.CenterReferencePoint)
playerImg.x= W*0.5
playerImg.y= H-50
playerImg.name = “player”
physics.addBody( playerImg, “dynamic”, { density=0.0, friction=0.0, bounce=0.0, radius=25 } )

local motionx = 0
local motiony = 0
local function onAccelerate( event )

motionx = 50 * event.xGravity
motiony = 50 * event.yGravity

end
Runtime:addEventListener (“accelerometer”, onAccelerate)

local function moveplayer (event)

playerImg.x = playerImg.x + motionx
playerImg.y = playerImg.y - motiony

end
Runtime:addEventListener(“enterFrame”, moveplayer)
–collision detection–
local function onCollision(self,event)
if self.name == “player” and event.other.name == “block” then
Runtime:removeEventListener(“enterFrame”, moveplayer)
display.remove(playerImg)
end
end
playerImg.collision = onCollision
playerImg:addEventListener(“collision”, playerImg) [import]uid: 63956 topic_id: 10833 reply_id: 310833[/import]

The physics engine does not work properly when you have physics objects in different groups that are moved or scaled. The reason is because each display group has it’s own local coordinate system which is seperate from the global coordinate system so it confuses the physics engine. I don’t believe there is a solution or work around at this time. The only way for it to work is if you move the objects individually (instead of moving the group that they are in). Another thread with links to more in depth explanations can be found here:
http://developer.anscamobile.com/forum/2010/09/17/moving-objects-group-collision
[import]uid: 27965 topic_id: 10833 reply_id: 39478[/import]

Thanks for reply!
Now is more clear but I don’t see any solution about that.
Maybe I’ll be back to a random generation,
thanks a lot. [import]uid: 63956 topic_id: 10833 reply_id: 39619[/import]