Adding display group as physics body

Hi All,

First post on here, so hopefully I can explain what I’m doing properly. I’ve created a couple of images that I group together in a display group. They overlap each other and with transparency, create the image I want to compose. This seems like the ideal use of a display group.

The components are round, such that if I add layer1 to as a physics body with a radius, it works properly. But once they’re all inside the display group, I know I can’t add the things inside the display group to as physics bodies… I have to add the display group.

The display group doesn’t position the center of its radius in the center of the display group, but rather the 0,0 top-left corner of the display group. How do I move the physics body center? Changing xReference/yReference doesn’t seem to do anything in the case of physics.

 physics.setDrawMode("hybrid")  
 local fullthing = display.newGroup()  
 local layer1 = display.newImage("layer1.png")  
 fullthing:insert(layer1)  
  
 physics.addBody(fullthing, {density=1.0,radius=200})  

You should see that the debug draw mode draws a circle with its center at the top-left of the group box, not at the center of the group box.
[import]uid: 12644 topic_id: 4932 reply_id: 304932[/import]

Actually. I take this slightly back. It seems that display.newImage(fullthing, “layer1.png”, 0, 0) did not position the image inside the group as I had expected. In fact, if I set the x=0 and y=0 of layer1 explicitly after it’s created, then it positions it exactly as I had expected! … talk about strange. It’s like the top,left parameters of display.newImage aren’t working. [import]uid: 12644 topic_id: 4932 reply_id: 15979[/import]