Erel B4X founder Staff member Licensed User Longtime User Sep 6, 2018 #1 This is really a nice example. You draw objects with your finger and they almost come to life: Run with debug drawing to see the bodies structure: Note that chain shapes cannot collide with other chain shapes in box2d. Instead we create bodies with multiple polygon shapes. You can play with the angle interval to make it more accurate: B4X: X2.GraphicCache.PutGraphic2(gname, Array(sb), antialias, 3) The example is included in the examples pack: https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/ Building the body shapes is not trivial. The code is quite short but is a bit complex. Post here if you need any explanation.
This is really a nice example. You draw objects with your finger and they almost come to life: Run with debug drawing to see the bodies structure: Note that chain shapes cannot collide with other chain shapes in box2d. Instead we create bodies with multiple polygon shapes. You can play with the angle interval to make it more accurate: B4X: X2.GraphicCache.PutGraphic2(gname, Array(sb), antialias, 3) The example is included in the examples pack: https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/ Building the body shapes is not trivial. The code is quite short but is a bit complex. Post here if you need any explanation.
LucaMs Expert Licensed User Longtime User Sep 6, 2018 #2 Really very nice [EDIT] And it's a good idea for successful apps! (pity I wrote this ). Last edited: Sep 6, 2018
Erel B4X founder Staff member Licensed User Longtime User Sep 7, 2018 #3 Updated the example. You can now drag existing objects. X2Utils.GetBodiesIntersectingWithWorldPoint was fixed. Previously it only tested the body's first fixture.
Updated the example. You can now drag existing objects. X2Utils.GetBodiesIntersectingWithWorldPoint was fixed. Previously it only tested the body's first fixture.