|
|
@ -16,10 +16,14 @@ class BumpingBehavior extends ContactBehavior {
|
|
|
|
super.postSolve(other, contact, impulse);
|
|
|
|
super.postSolve(other, contact, impulse);
|
|
|
|
if (other is! BodyComponent) return;
|
|
|
|
if (other is! BodyComponent) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final worldManifold = WorldManifold();
|
|
|
|
|
|
|
|
contact.getWorldManifold(worldManifold);
|
|
|
|
|
|
|
|
|
|
|
|
other.body.applyLinearImpulse(
|
|
|
|
other.body.applyLinearImpulse(
|
|
|
|
contact.manifold.localPoint
|
|
|
|
worldManifold.normal
|
|
|
|
..normalize()
|
|
|
|
..multiply(
|
|
|
|
..multiply(Vector2.all(other.body.mass * _strength)),
|
|
|
|
Vector2.all(other.body.mass * _strength),
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|