b2w_addPolygonShape function

  1. @Native<Void Function(Int64, Pointer<Float>, Int32, Float, Float, Float)>(ffi.Int64, ffi.Pointer<ffi.Float>, ffi.Int32, ffi.Float, ffi.Float, ffi.Float)>()
void b2w_addPolygonShape(
  1. int bodyHandle,
  2. Pointer<Float> verts,
  3. int count,
  4. double density,
  5. double friction,
  6. double restitution,
)

Attach a convex polygon. verts: count points as x0, y0, x1, y1, …; Box2D takes their convex hull. More than 8 points (Box2D's limit) are cut into a fan of pieces that share the first point, so the body keeps the whole shape. Fewer than 3 attach nothing.

Implementation

@ffi.Native<
  ffi.Void Function(
    ffi.Int64,
    ffi.Pointer<ffi.Float>,
    ffi.Int32,
    ffi.Float,
    ffi.Float,
    ffi.Float,
  )
>()
external void b2w_addPolygonShape(
  int bodyHandle,
  ffi.Pointer<ffi.Float> verts,
  int count,
  double density,
  double friction,
  double restitution,
);