0

I'm trying to create some terrain for my Box2dWeb -game. After reading the rather tiny documentation for Box2DWeb I am unsure if I can create long edge chains from a set of coordinates. I think the box2d feature for this is called "chain shapes" but so far I haven't seen anyone use them with javascript versions of box2d.

Do you know if there is a good way of drawing a line trough a set of coordinates in box2dweb? For example, how would I draw a line trough the following svg coordinates:

<svg>
<g id="Layer_3">
    <polyline fill="none" stroke="#0000FF" stroke-width="3" points="33,108 66,141 99,174 99,207 132,207 165,207 165,240     "/>
</g>
</svg>
Sony packman
  • 810
  • 2
  • 10
  • 21
  • EdgeShape does not work in box2dweb (collision issues). Other method is to use b2PolygonShape.SetAsEdge method, but it too glitchy (i need it to use with rays, it simply does not work, rays randomly pass through edges). Box2dweb is nearly impossible to use in real projects, it just pain. – gridsane Oct 22 '13 at 17:26
  • Thanks for your reply! I ended up parsing the coordinates with javascript and automatically creating regular edges in way way that forms a chain. – Sony packman Oct 23 '13 at 17:50
  • I created two tests, second one shows the glitches: [Edges test 1](http://jsfiddle.net/gridsane/etceb/3), [Edges test 2](http://jsfiddle.net/gridsane/etceb/6) In this examples i used [box2dweb with the ray normal fixes](https://github.com/gridsane/box2dweb) – gridsane Oct 24 '13 at 06:15

1 Answers1

0

I had the same issue. Ended up writing a Python script that parses the svg and spits out Box2dWeb javascript. Check it out: https://github.com/kylophone/SVG-Box2dWeb