b2w_setImpactCallback function

  1. @Native<Void Function(Int64, ImpactCallbackFn, Float)>(ffi.Int64, ImpactCallbackFn, ffi.Float)>()
void b2w_setImpactCallback(
  1. int worldHandle,
  2. ImpactCallbackFn callback,
  3. double speedThreshold
)

Have b2w_step call callback for every contact whose shapes closed faster than speedThreshold (units per second) in that step, with the two bodies and that speed: Box2D's hit events. It is called on the thread that called b2w_step, after the step and before b2w_step returns; it must not call back into this library (a Dart NativeCallable.listener, which only queues the call, is the way to receive it). NULL removes the callback, and with no callback Box2D gathers no hit events.

Implementation

@ffi.Native<ffi.Void Function(ffi.Int64, ImpactCallbackFn, ffi.Float)>()
external void b2w_setImpactCallback(
  int worldHandle,
  ImpactCallbackFn callback,
  double speedThreshold,
);