I resolved the issue. The problem is when you set “[lua]obj.isBodyActive = false[/lua]” but the obj is still in moviment. To correct this, ensure the obj is stoped. I use:
Be sure you remove your bodies in the next EnterFrame event. Otherwise you will get an error.
Something like that :
[code]
local function remove_object()
object:removeSelf()
object = nil
end
local function onEnterFrame(event)–remove the object in the next frame event
if remove_flag == true then
remove_flag = false
remove_object()
end
end
Runtime:addEventListener(“enterFrame”, onEnterFrame)
[import]uid: 12632 topic_id: 6583 reply_id: 29333[/import]
I’m wondering if there’s any word from the Box2d guys if this is going to actually get fixed properly at some point, or if it’s fixed in the daily builds? This one bug has resulted in almost two days of debugging and work arounds, and I still see it from time to time!
The bug is much less frequent following some of the very handy advice in this thread, but I’m still seeing it. Once I do more cleanup on the code, I may be able to get rid of all remaining instances of it (not my code base, I’m cleaning up/adding features), but for now, it’s just kind of causing some hair tearing.
if cleanupFlag == true then
local gameTheme = gameSettings["gameTheme"]
destroyBullet()
cleanupFlag = false
if cleanupIndex == 1 then
enemy:removeSelf()
createOneEnemy(gameTheme, enemy1, 1, -75)
elseif cleanupIndex == 2 then
etc....
end
The “destroyBullet” code is to get rid of the bullet object, and is similar:
Well, in further testing, what I’ve done is remove any use of isBodyActive and instead just rely on my cleanup code of :removeSelf(). This can still create a race condition where the player gets hit by something they already destroyed (if the collision happens in the one frame prior to destruction), but it’s a pretty rare case, and a solveable one.
However, it would be great to hear that the underlying Box code was fixed to make isBodyActive usable in most cases. Or deprecate it in favor of a newer, better method.
Thought I’d share that, since I’m guessing I’m not the only one having the problem. Cheers, and thanks Box2D and Corona! Despite debugging frustrations, this library still saves weeks of time, so don’t think I/we’re not grateful! [import]uid: 37043 topic_id: 6583 reply_id: 40576[/import]
“Warning: could not load the font helvetica-bold.”
how to get rid of it?
I want to use helvetica-bold.
please help. [import]uid: 176812 topic_id: 6583 reply_id: 129353[/import]
And another problem is that until the car collides with the middle point of the bunnies or hurdles the collusion occurs only then. I want it to occur even if the player object hits the bunnies. kindly help me in this regard. It will be deeply appreciated! Thanks. [import]uid: 176812 topic_id: 6583 reply_id: 129354[/import]
“Warning: could not load the font helvetica-bold.”
how to get rid of it?
I want to use helvetica-bold.
please help. [import]uid: 176812 topic_id: 6583 reply_id: 129353[/import]
And another problem is that until the car collides with the middle point of the bunnies or hurdles the collusion occurs only then. I want it to occur even if the player object hits the bunnies. kindly help me in this regard. It will be deeply appreciated! Thanks. [import]uid: 176812 topic_id: 6583 reply_id: 129354[/import]