Hello,
This is the first tile i use box2D and i want to know if it is possible to detect collisions between 2 objects which they are not in the same world ?
If it is not possible, i want to make something like Flappy Bird were an object fall and other object like all sleep to the left of the screen. How can i do ?
Thank you
Comments
I do not understand what you mean with 2 objects not in the same world. May be multiverse?
self.world1 = b2.World.new(0, 25, true)
self.world2 = b2.World.new(-25, 0, true)
The world1 make the object fall
body = self.world1:createBody{type = b2.DYNAMIC_BODY}
The world2 make the wall going to the left
body2 = self.world2:createBody{type = b2.DYNAMIC_BODY}
They can't interact because they are not in the same world
The Gobb : https://play.google.com/store/apps/details?id=fr.toastapp.thegobb
If you want a body to drop and a wall to move left, then you can simply create a dynamic body (which will drop because it's dynamic) and create a kinetic body for the wall (which will move only when you tell it to) and set its LinearVelocity to (-1, 0). The dynamic body will drop and the kinetic body will move left. They will collide, and both live in the same world.
The Gobb : https://play.google.com/store/apps/details?id=fr.toastapp.thegobb
https://play.google.com/store/apps/details?id=com.dragonflyapps.savethedigger
https://play.google.com/store/apps/details?id=com.dragonflyapps.whackazombie
The Gobb : https://play.google.com/store/apps/details?id=fr.toastapp.thegobb