refactor: used new createJoint method (#117)

pull/133/head
Alejandro Santiago 4 years ago committed by GitHub
parent 07ddb1f7b6
commit 930c7fa001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,7 +31,7 @@ class ChromeDino extends BodyComponent with InitialPosition {
anchor: anchor,
);
final joint = _ChromeDinoJoint(jointDef);
world.createJoint2(joint);
world.createJoint(joint);
return joint;
}
@ -154,15 +154,3 @@ class _ChromeDinoJoint extends RevoluteJoint {
setMotorSpeed(-motorSpeed);
}
}
extension on World {
// TODO(alestiago): Remove once Forge2D supports custom joints.
void createJoint2(Joint joint) {
assert(!isLocked, '');
joints.add(joint);
joint.bodyA.joints.add(joint);
joint.bodyB.joints.add(joint);
}
}

@ -68,7 +68,7 @@ class Flipper extends BodyComponent with KeyboardHandler, InitialPosition {
anchor: anchor,
);
final joint = _FlipperJoint(jointDef);
world.createJoint2(joint);
world.createJoint(joint);
unawaited(mounted.whenComplete(joint.unlock));
}
@ -219,15 +219,3 @@ class _FlipperJoint extends RevoluteJoint {
setLimits(-angle, angle);
}
}
// TODO(alestiago): Remove once Forge2D supports custom joints.
extension on World {
void createJoint2(Joint joint) {
assert(!isLocked, '');
joints.add(joint);
joint.bodyA.joints.add(joint);
joint.bodyB.joints.add(joint);
}
}

Loading…
Cancel
Save