So this is what I want:
[lua]
local object = display.newSprite(…)
physics.addBody( object, “dynamic”, {name = “element1”, shape={…}},
{name = “element2” , shape={…}})
– here I want to disable element named “element1”
– “same as” object.isBodyActive = false
[/lua]
Is there any other way than collision detection to iterate physic objects elements?
The reason I am doing this is that I want to change my character in the middle of the game. And the body shape needs to be changed to the new character’s width and height.
Of course I can check what character is now being used and use it as a flag in collision detection, but it feels wrong that you have elements active you don’t need.