Each object is a table, even display objects. Assign properties to them to identify them:
[lua]function newPerson(name)
local group = display.newGroup()
group.class = “person”
group.name = name
physics.addBody(group)
return group
end[/lua]
This would create a group which is unique, can be placed within other groups and can contain unique content.
The trick with display groups as physics objects is simply to not move their containing group. For example, if the code above added the physics body to an object with ‘group’ and then moved ‘group’, the physics body would get out of sync with the ‘world’.
Its a pain, but you need to treat ALL physics bodies as being relative to the 0,0 of the world, even if they are in their own group. And that means not moving their parent groups at all. [import]uid: 8271 topic_id: 35382 reply_id: 140607[/import]