Games [XUI2D] Drawing lines example

Discussion in 'Game Development' started by Erel, Sep 6, 2018.

  1. Erel

    Erel Administrator Staff Member Licensed User

    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:
    X2.GraphicCache.PutGraphic2(gname, Array(sb), antialias, 3)
    The example is included in the examples pack:

    Building the body shapes is not trivial. The code is quite short but is a bit complex. Post here if you need any explanation.
  2. LucaMs

    LucaMs Expert Licensed User

    Really very nice :)

    [EDIT] And it's a good idea for successful apps! (pity I wrote this :D).
    Last edited: Sep 6, 2018
    Erel likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    Updated the example. You can now drag existing objects.

    X2Utils.GetBodiesIntersectingWithWorldPoint was fixed. Previously it only tested the body's first fixture.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice