hannojg / react-native-box2d

JSI port of the Box2D physics engine for React Native.
MIT License
61 stars 3 forks source link

Add polygon shape from points #4

Closed tomekzaw closed 1 year ago

tomekzaw commented 1 year ago

This PR exposes Set method which allows to create a polygon shape from an array of local points.

Example usage:

const shape = Box2d.b2PolygonShape();
shape.Set([
  Box2d.b2Vec2(0.0, 0.0),
  Box2d.b2Vec2(1.0, 0.0),
  Box2d.b2Vec2(1.0, 1.0),
]);