mirror of https://github.com/flutter/pinball.git
parent
95911fea63
commit
62eb17dcf1
@ -0,0 +1,13 @@
|
|||||||
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||||
|
|
||||||
|
void beginContact(Forge2DGame game, BodyComponent bodyA, BodyComponent bodyB) {
|
||||||
|
assert(
|
||||||
|
bodyA.body.fixtures.isNotEmpty && bodyB.body.fixtures.isNotEmpty,
|
||||||
|
'Bodies require fixtures to contact each other.',
|
||||||
|
);
|
||||||
|
|
||||||
|
final fixtureA = bodyA.body.fixtures.first;
|
||||||
|
final fixtureB = bodyB.body.fixtures.first;
|
||||||
|
final contact = Contact.init(fixtureA, 0, fixtureB, 0);
|
||||||
|
game.world.contactManager.contactListener?.beginContact(contact);
|
||||||
|
}
|
Loading…
Reference in new issue