Edge Shapes for C++ (Merged!)

It depends on the scenario.

When a surface could be represented either as a single edge, or as a 4-sided polygon with 3 of the sides unused, it is significantly faster to use the edge.

When a convex surface could be represented as either 8 edges or an 8-sided polygon, the representation that is faster depends on how the bounding boxes overlap. If a large shape approaches and its bounding box overlaps all 8 sides of the surface, it's faster to do one collision test against a polygon than it is to use 8 collision tests against edges. But if it's a small shape that's just resting on top of one side of the surface, then it's faster again to use a collision test against 1 edge than a collision test against an 8 sided polygon. I don't know how in-between cases work out, but it clearly varies as the situation changes over time.

On the whole, I would recommend using these edges for static level geometry, and keep it consistent for simplicity. But then again, I made them, so I'm biased. 🙂
Thanks
I think it would be a good idea to switch toward edges Chain then 🙂
Just a note for any JBox2d users, edges are now in JBox2d SVN (rev 141 - you can grab a tarball from http://jbox2d.svn.sourceforge.net/viewv ... z?view=tar, sorry, that tarball has the tag branches included so it's a hefty 11 mb), and seems to be working well. Great job on this, shaktool, it's going to be very useful!

FWIW, I haven't noticed any sleeping issues with this, things seem to be behaving like they should.
ewjordan wrote:
Just a note for any JBox2d users, edges are now in JBox2d SVN (rev 141 - you can grab a tarball from http://jbox2d.svn.sourceforge.net/viewv ... z?view=tar, sorry, that tarball has the tag branches included so it's a hefty 11 mb), and seems to be working well. Great job on this, shaktool, it's going to be very useful!

Awesome, thank you! I'm going to try these soon, hopefully they will simplify my level preparation code and get rid of the "thin triangles" -problem, once and for all. 🙂
ewjordan wrote:
Just a note for any JBox2d users, edges are now in JBox2d SVN (rev 141 - you can grab a tarball from http://jbox2d.svn.sourceforge.net/viewv ... z?view=tar, sorry, that tarball has the tag branches included so it's a hefty 11 mb), and seems to be working well. Great job on this, shaktool, it's going to be very useful!

FWIW, I haven't noticed any sleeping issues with this, things seem to be behaving like they should.


Yep, just integrated it tonight. Along with the tile combining code I have, this works like a real charm now. Thanks!
Sorry for this question here, but whats the easiest way to get the edge shape files (c++)? I don't see a zip file anywhere here and though I found the revision list on source forge I don't know how to get just the added/altered files.
Get a Subversion client. Assuming you get a command line version, you can check out a new copy of the most recent code with:
Code:
svn checkout http://box2d.svn.sourceforge.net/svnroot/box2d
And in the future, to update that copy to the most recent version, run:
Code:
svn update
from the box2d directory.

If you prefer a GUI version of the client, I hear Tortoise SVN is pretty good on Windows, however I do not know how to use it.
Or you can simply click, "Download GNU Tarball" and it'll tar up the whole revision for you: http://box2d.svn.sourceforge.net/viewvc/box2d.tar.gz?view=tar
I was looking for a way to just grab the edge shape related files, not the whole project but I'll just grab everything via Tortoise SVN. Cheers.
Hello and thank you very much for edge shapes! They make life a lot nicer and faster. I am having a bit of trouble w/ the "correct" and "incorrect" sides, however. I am swapping out my physics engine from Chipmunk to Box2D at the moment and really liked the behavior of Chipmunk LineSegments a lot. Both sides of a Chipmunk LineSegment collides equally and there is no "forcing" of objects through to the other side.

This seems to be a lot less confusing when designing a level in an editor, every LineSegment is simply a "wall" through which nothing can pass from either side. With Edge Shapes however, you have to be always aware of which side is which and this is a pain to represent graphically and to keep track of in your head. I had considered just making my own "Edge" class that is actually just a very thin rectangle under the covers, but I like the efficiency and ease-of-use of Edges, especially now that they have been merged.

I'm wondering if anyone can point me in the right direction to make a quick local fix for this? I'm hoping there is something simple and efficient, such as evaluating collisions on a Edge twice, once for the vertices normally and once with them swapped around. I'm not familiar with the Box2D code so any advice on this would be great. Thank you -

Original thread: https://box2d.org/forum/viewtopic.php?t=1577