box2d.js icon indicating copy to clipboard operation
box2d.js copied to clipboard

EdgeShape

Open schteppe opened this issue 12 years ago • 1 comments

Hi, Wanted to create a b2EdgeShape, but I see that a few properties are not exposed through the JS api. I investigated it like this:

var edge = new b2EdgeShape();
console.log(edge)

There are no functions for setting m_vertex1, m_vertex2, m_hasVertex0, m_hasVertex3. These are the properties I need for now...

They are defined in the Box2D C++ code here: https://github.com/kripken/box2d.js/blob/master/Box2D_v2.2.1/Box2D/Collision/Shapes/b2EdgeShape.h#L57

Thanks for an otherwise great port, it's been working nicely for me so far!

Stefan

schteppe avatar Jul 13 '13 12:07 schteppe

you need to write in .cpp library as below
b2Vec2 m_vertex0; b2Vec2 m_vertex3; bool m_hasVertex0; boo m_hasVertex3; then you have to generate code from cpp to js using tool.I hope it will work.

85mukesh avatar Nov 18 '13 07:11 85mukesh