addCollisionComponent method

  1. @override
Future<void> addCollisionComponent(
  1. ThermionEntity entity, {
  2. void callback(
    1. int entityId1,
    2. int entityId2
    )?,
  3. bool affectsTransform = false,
})
override

Makes entity collidable. This allows you to call testCollisions with any other entity ("entity B") to see if entity has collided with entity B. The callback will be invoked if so. Alternatively, if affectsTransform is true and this entity collides with another entity, any queued position updates to the latter entity will be ignored.

Implementation

@override
Future<void> addCollisionComponent(ThermionEntity entity,
    {void Function(int entityId1, int entityId2)? callback,
    bool affectsTransform = false}) async {
  throw UnimplementedError();
  // final JSFunction? jsCallback = callback != null
  //     ? allowInterop(
  //         (int entityId1, int entityId2) => callback(entityId1, entityId2))
  //     : null;
  // await _shim
  //     .addCollisionComponent(entity,
  //         callback: jsCallback,
  //         affectsTransform: affectsTransform.toJSBoolean())
  //     .toDart;
}