Birch-san / box2d-wasm

Box2D physics engine compiled to WebAssembly. Supports TypeScript and ES modules.
263 stars 21 forks source link

how to Change the shape of body dynamically #51

Open a6965921 opened 2 years ago

a6965921 commented 2 years ago
const gravity = new b2Vec2(0, 10);

world = new b2World(gravity);

const bd_ground = new b2BodyDef();

const ground = world.CreateBody(bd_ground);
const shape = new b2EdgeShape();
var xx=new b2Vec2(3, 4)
shape.SetTwoSided(xx, new b2Vec2(6, 7));
ground.CreateFixture(shape, 0);
V-HuangChunMing commented 1 year ago

you can destory this fixture and recreate