addMagneticForce method
Add magnetic force towards a target
Implementation
void addMagneticForce(String name, Vector2 target, double strength) {
final direction = (target - position).normalized();
addForce(name, direction * strength);
}
Add magnetic force towards a target
void addMagneticForce(String name, Vector2 target, double strength) {
final direction = (target - position).normalized();
addForce(name, direction * strength);
}