I am using the default gameUI.lua file provided in the sample applications to drag my physics bodies around the stage. The behavior works perfectly when my bodies are just created and added to the default stage, however if I try and add these bodies to another display group everything gets wonky.
I am adding the bodies to a display group so I can move the group as a whole, this is throwing off the x/y of the gameUI code I believe.
Is there a way to apply a target display object to the physics engine? This way I could create my display group that I am adding bodies to and also have the dragging functionality behave as it should?
Here is what I’m doing:
[lua]…
local env = display.newGroup ()
…
local block = display.newImageRect ( path, origW, origH )
physics.addBody (block, blockMaterial)
block:addEventListener (“touch”, dragBody)
env:insert (block)
env.y = 120[/lua] [import]uid: 11554 topic_id: 4724 reply_id: 304724[/import]