I’ve got a bunch of UI objects, and then a bunch of rects added as bodies to Physics.
What’s a canonical way of retrieving only those display objects that are part of the Physics engine?
I’m lazy and would love it if there was a Physics.getRigidBodies() function. Barring that, is this the simplest way?
local function getRigidBodies()
local bodies = {}
local stage = display.getCurrentStage()
for i=1,stage.numChildren do
if stage[i].bodyType then
bodies[#bodies+1] = stage[i]
end
end
return bodies
end
Thanks
Alex
[import]uid: 3473 topic_id: 2279 reply_id: 302279[/import]