kripken / box2d.js

Port of Box2D to JavaScript using Emscripten
1.32k stars 198 forks source link

EdgeShape #37

Open schteppe opened 11 years ago

schteppe commented 11 years ago

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

85mukesh commented 10 years ago

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.