EdgeShapes (aka Thin Line Segments)

EdgeShapes can be attached to any body now. I recommend attaching them to static bodies, or at least to bodies with bullet mode enabled (they don't deal well with deep intersections), but this is not enforced.
Shaktool,

Just to update, I got it working once i updated and the results are really good. For me, this addition cancels out the "im not looking forward to creating static level objects" feeling i get when i open up a new experiment.

Thanks for this addition everyone and the work which has been going on that i didnt know about. The new SVN code seems to make much more sense to me.

All in all the last 3 days have been pretty sweet in box2d land. 😀
shaktool wrote:
EdgeShapes can be attached to any body now.

Hi, Shaktool. Could you please tell us how to attach EdgeShapes to a dynamic body? I tried the following but didn't work:
Code:
//I removed this statement: world.GetGroundBody().CreateShape(chainDef);
//assume we set chainDef.density = .5;
var bodyDef: b2BodyDef = new b2BodyDef();
bodyDef.position.Set(0.0, 3.0);
var body:b2Body = world.CreateBody( bodyDef);
body.CreateShape(chainDef);
body.SetMassFromShapes();

Sincerely,
If you dig into the creation of the shapes and bodies, calling SetMassFromShapes() calls a function on each shape that computes the mass. For edge shapes, this always returns a zero mass.
VengantMjolnir wrote:
If you dig into the creation of the shapes and bodies, calling SetMassFromShapes() calls a function on each shape that computes the mass. For edge shapes, this always returns a zero mass.

Do you know the syntax to attach EdgeShapes to a dynamic body?
Well, if you give your dynamic body another shape to compute the mass from( say a circle ) then you could do that. Otherwise just set the mass yourself using SetMass( massData:b2MassData );

This does work, I've tried it. Problem is that edge shapes only collide properly on one side, so you can't just have a thin edge shape bouncing around, you'd have to close it off. And in that case, why are you using an edge shape again?
Hi, VengantMjolnir. Appreciated your reply, but you didn't share the code about attaching EdgeShapes to a dynamic body. This is one thing now that I am curious about.
Hi again!

Yeah i have ran into the same issue as before. (Latest r38)

I cant narrow down the issue however.

I have a motorbike now on my "half pipe" which is drawn with inkscape and works (thanks to your parser). On one SVG, everything is fine. (See screen1 below)

Next, i drew a new SVG file. It was probably larger than the old SVG in terms of more surfaces but not too crazy. This time it didnt work like before (See screen2 below).

I dont understand what is changing to cause the problem. For example, i load in the SVG so all i need to do is change the SVG file, no code is changed between Screen1 and Screen2. So either something special has to happen when i draw a SVG (need to close the path?) or im hitting a maximum value somewhere causing the chain to fail.

Does anyone have any ideas?
Could you send me both SVGs?
Yeah mate its attached. I have been messing around so much with the SVG files that i lost track, but here is a broken one and a working one which i just tested.

I use a slightly different method than your testbed for parsing the SVG, although not much has changed apart from i scale the points directly (as opposed to the SVG file being 26X20; Same thing.

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