Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Set the RopeJoint's local anchors to null vectors by default #67

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions packages/forge2d/lib/src/dynamics/joints/rope_joint_def.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ class RopeJointDef<A extends Body, B extends Body> extends JointDef<A, B> {
/// The maximum length of the rope. Warning: this must be larger than
/// linearSlop or the joint will have no effect.
double maxLength = 0.0;

RopeJointDef() : super() {
localAnchorA.setValues(-1.0, 0.0);
localAnchorB.setValues(1.0, 0.0);
}
}
10 changes: 10 additions & 0 deletions packages/forge2d/test/dynamics/joints/rope_joint_def_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,15 @@ void main() {
test('can be instantiated', () {
expect(RopeJointDef(), isA<RopeJointDef>());
});

group('constructor', () {
test('sets localAnchorA to zero', () {
expect(RopeJointDef().localAnchorA, equals(Vector2.zero()));
});

test('sets localAnchorB to zero', () {
expect(RopeJointDef().localAnchorB, equals(Vector2.zero()));
});
});
});
}