Hello
I have two questions about physics in Gideros Studio.
When I detect a collision between two objects and I want to destroy one of the objects, I get the error: world is locked
I wanted to check in the class of one of the objects, if it is detroyed or not and if it isn't I wanted to detroy it, but I got the error: Body has already been detroyed.
I would be glad for any help!
Comments
http://appcodingeasy.com/Gideros-Mobile/Gideros--remove-object-on-collision
I think that this discussion should help
http://giderosmobile.com/forum/discussion/comment/5906#Comment_5906
My problem is, that when I exit the first level and enter the second one, the physics bodies I used in level 1 are still there. To generate the levels I'm using for loops and local classes (for the platforms).
Any idea how to do this?
I tried this:
if win == false then
b2.world:destroyBody(bodyA)
b2.world:destroyBody(bodyB)
win = true
end
But it didn't work...
if old world loses all references, it will be garbage collected with all bodies in it
http://appcodingeasy.com/Gideros-Mobile/Manage-Scenes-in-Gideros-Mobile
There's no error.
I'm using the Scene Manager. When the Level class is called, I create a new world.
Also, turning on debug drawing will help you a lot.
I've already changed it to levelScene.world:b2.World.new(0,0) and so on.
But, as I said, the collisions don't work then.