User Tag List

Results 1 to 5 of 5

Thread: Box2D Polygon Not Clockwise?

  1. #1
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Box2D Polygon Not Clockwise?

    I have a polygon, created by a CSV string, that Box2D says is not clockwise. It is u_ u

    "0,35,174,3,197,3,228,9,249,24,266,46,278,69,291,9 8,300,120,304,139,304,143,0,143"

  2. #2
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D Polygon Not Clockwise?

    Oh. I figured it out. Apparently it won't work if it's clockwise, needs to be counter-clockwise.

  3. #3
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D Polygon Not Clockwise?

    The problem is that the polygon has parallel edges. There are multiple points on the same edge in your polygon and this is not allowed. Removing these points will solve the problem.

  4. #4
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D Polygon Not Clockwise?

    Well, I don't see why inverting the order of the vertices fixed it then.

    What is the most efficient way to test how many times a body collides with another body or an edge chain (collectively)? I tried straight collision testing, but it seems to work for more than just the body I specify.

  5. #5
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D Polygon Not Clockwise?

    No idea why reversing the order worked, that should have caused even more Assertions...

    Something like this should work, assuming you're registering collisions properly:
    Code:
    * On Collision Begin
    + "BodyID" of "Object" = CollBody1("Phizix")
    > Add 1 to counter
    Where BodyID is a value on the object holding it's Body ID.
    You can choose a more specific collision condition if your objects have collision types.

Similar Threads

  1. Box2D polygon problems...
    By Ethan in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 9th April 2011, 03:03 AM
  2. clockwise or anti-clockwise rotation
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 22nd January 2011, 01:13 PM
  3. Box2D Polygon String
    By Dave_of_Canada in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 19th July 2010, 05:15 AM
  4. Stats Polygon
    By dj_tommy_k in forum File Archive
    Replies: 1
    Last Post: 19th March 2009, 07:21 PM
  5. Circular movement, Ant-clockwise and Clockwise?
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 13th August 2008, 06:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •