Skip to content

Commit

Permalink
refactor: rename to isBullet
Browse files Browse the repository at this point in the history
  • Loading branch information
alestiago committed Oct 30, 2023
1 parent f7514e2 commit 61f62d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/forge2d/lib/src/dynamics/body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,11 @@ class Body {
}

/// Is this body treated like a bullet for continuous collision detection?
bool get bullet => (flags & bulletFlag) == bulletFlag;
bool get isBullet => (flags & bulletFlag) == bulletFlag;

/// Whether this body should be treated like a bullet for continuous collision
/// detection.
void setBullet(bool flag) {
set isBullet(bool flag) {
if (flag) {
flags |= bulletFlag;
} else {
Expand Down
8 changes: 4 additions & 4 deletions packages/forge2d/lib/src/dynamics/world.dart
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,8 @@ class World {
continue;
}

final collideA = bodyA.bullet || typeA != BodyType.dynamic;
final collideB = bodyB.bullet || typeB != BodyType.dynamic;
final collideA = bodyA.isBullet || typeA != BodyType.dynamic;
final collideB = bodyB.isBullet || typeB != BodyType.dynamic;

// Are these two non-bullet dynamic bodies?
if (collideA == false && collideB == false) {
Expand Down Expand Up @@ -838,8 +838,8 @@ class World {
// Only add static, kinematic, or bullet bodies.
final other = contact.getOtherBody(body);
if (other.bodyType == BodyType.dynamic &&
body.bullet == false &&
other.bullet == false) {
body.isBullet == false &&
other.isBullet == false) {
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/forge2d/test/dynamics/body_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ void main() {
test('can change', () {
final body = Body(BodyDef(), World());
const newBulletValue = true;
expect(body.bullet, isNot(equals(newBulletValue)));
expect(body.isBullet, isNot(equals(newBulletValue)));

body.bullet = newBulletValue;
body.isBullet = newBulletValue;

expect(body.bullet, equals(newBulletValue));
expect(body.isBullet, equals(newBulletValue));
});
});

Expand Down

0 comments on commit 61f62d3

Please sign in to comment.