Birch-san / box2d-wasm

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

How to instantiate b2RayCastInput class #57

Closed 8Observer8 closed 1 year ago

8Observer8 commented 1 year ago

Hello,

I need to create an instance of the b2RayCastInput class like in the tutorial: https://www.iforce2d.net/b2dtut/raycasting

      //set up input
      b2RayCastInput input;
      input.p1 = p1;
      input.p2 = p2;
      input.maxFraction = 1;

I try to do like this: https://plnkr.co/edit/vwQsOkQrbx8y8l5m

    const {
        b2_dynamicBody,
        b2BodyDef,
        b2PolygonShape,
        b2RayCastInput,
        b2Vec2,
        b2World
    } = box2d;

    const input = new b2RayCastInput();

But I have this error: cannot construct a b2RayCastInput, no constructor in IDL

8Observer8 commented 1 year ago

I'm sorry. I forgot to look the docs folder: