b2w_addChainShape function

  1. @Native<Int64 Function(Int64, Pointer<Float>, Int32, Int32, Float, Float)>(ffi.Int64, ffi.Pointer<ffi.Float>, ffi.Int32, ffi.Int32, ffi.Float, ffi.Float)>()
int b2w_addChainShape(
  1. int bodyHandle,
  2. Pointer<Float> points,
  3. int count,
  4. int loop,
  5. double friction,
  6. double restitution,
)

Attach a chain of segments. points: count points as x0, y0, x1, y1, …; loop != 0 joins the last back to the first. At least 4 points; an open chain's first and last are ghosts that only shape its ends. A chain is one-sided: it collides on the right of its direction (counter-clockwise points face out) and sensors never see it. Returns its handle, for b2w_destroyChain; 0 for too few points or a dead body.

Implementation

@ffi.Native<
  ffi.Int64 Function(
    ffi.Int64,
    ffi.Pointer<ffi.Float>,
    ffi.Int32,
    ffi.Int32,
    ffi.Float,
    ffi.Float,
  )
>()
external int b2w_addChainShape(
  int bodyHandle,
  ffi.Pointer<ffi.Float> points,
  int count,
  int loop,
  double friction,
  double restitution,
);