I want to combine 2 display objects into one group and then add this group object into the physics engine.
e.g. I can make some balls with a number at the center of each ball with just one ball image and a text object inserted into a group.
here is my code:
local g = {}
local c = {}
local t = {}
for i=1,36,1 do
g[i] = display.newGroup()
c[i] = display.newCircle(g[i], r*2+i*2,r*2,r)
t[i] = display.newText(g[i], tostring(i), r*2+i*2,r*2, native.systemFont, 16)
c[i]:setFillColor( 255,255,255,200)
t[i]:setTextColor(255,0,0)
g[i]:insert(c[i])
g[i]:insert(t[i])
physics.addBody( g[i], ballBodyElement )
end
There is no error when I run this code.
The ball and the text are moving together, but in a strange way.
So I think the physics engine may not support a group object as one physical object.
Can you add this feature? I think it’s useful for combined images in physical world.
Thanks! [import]uid: 35642 topic_id: 7769 reply_id: 307769[/import]