Skip to content

Commit

Permalink
fix setMassData
Browse files Browse the repository at this point in the history
  • Loading branch information
shakiba committed Sep 9, 2023
1 parent 3efc923 commit 820f610
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 22 deletions.
5 changes: 3 additions & 2 deletions dist/planck-with-testbed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Planck.js v1.0.0-beta.15
* Planck.js v1.0.0-beta.16
* @license The MIT license
* @copyright Copyright (c) 2021 Erin Catto, Ali Shakiba
*
Expand Down Expand Up @@ -3989,7 +3989,8 @@
this.m_sweep.setLocalCenter(massData.center, this.m_xf);
// Update center of mass velocity.
diffVec2(shift, this.m_sweep.c, oldCenter);
crossNumVec2(this.m_linearVelocity, this.m_angularVelocity, shift);
crossNumVec2(temp$6, this.m_angularVelocity, shift);
addVec2(this.m_linearVelocity, temp$6);
};
/**
* Apply a force at a world point. If the force is not applied at the center of
Expand Down
2 changes: 1 addition & 1 deletion dist/planck-with-testbed.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/planck-with-testbed.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/planck-with-testbed.min.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/planck-with-testbed.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Planck.js v1.0.0-beta.15
* Planck.js v1.0.0-beta.16
* @license The MIT license
* @copyright Copyright (c) 2021 Erin Catto, Ali Shakiba
*
Expand Down Expand Up @@ -3983,7 +3983,8 @@ var Body = /** @class */ (function () {
this.m_sweep.setLocalCenter(massData.center, this.m_xf);
// Update center of mass velocity.
diffVec2(shift, this.m_sweep.c, oldCenter);
crossNumVec2(this.m_linearVelocity, this.m_angularVelocity, shift);
crossNumVec2(temp$6, this.m_angularVelocity, shift);
addVec2(this.m_linearVelocity, temp$6);
};
/**
* Apply a force at a world point. If the force is not applied at the center of
Expand Down
2 changes: 1 addition & 1 deletion dist/planck-with-testbed.mjs.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/planck.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Planck.js v1.0.0-beta.15
* Planck.js v1.0.0-beta.16
* @license The MIT license
* @copyright Copyright (c) 2021 Erin Catto, Ali Shakiba
*
Expand Down Expand Up @@ -3989,7 +3989,8 @@
this.m_sweep.setLocalCenter(massData.center, this.m_xf);
// Update center of mass velocity.
diffVec2(shift, this.m_sweep.c, oldCenter);
crossNumVec2(this.m_linearVelocity, this.m_angularVelocity, shift);
crossNumVec2(temp$6, this.m_angularVelocity, shift);
addVec2(this.m_linearVelocity, temp$6);
};
/**
* Apply a force at a world point. If the force is not applied at the center of
Expand Down
2 changes: 1 addition & 1 deletion dist/planck.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/planck.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/planck.min.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/planck.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Planck.js v1.0.0-beta.15
* Planck.js v1.0.0-beta.16
* @license The MIT license
* @copyright Copyright (c) 2021 Erin Catto, Ali Shakiba
*
Expand Down Expand Up @@ -3983,7 +3983,8 @@ var Body = /** @class */ (function () {
this.m_sweep.setLocalCenter(massData.center, this.m_xf);
// Update center of mass velocity.
diffVec2(shift, this.m_sweep.c, oldCenter);
crossNumVec2(this.m_linearVelocity, this.m_angularVelocity, shift);
crossNumVec2(temp$6, this.m_angularVelocity, shift);
addVec2(this.m_linearVelocity, temp$6);
};
/**
* Apply a force at a world point. If the force is not applied at the center of
Expand Down
2 changes: 1 addition & 1 deletion dist/planck.mjs.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "planck",
"version": "1.0.0-beta.15",
"version": "1.0.0-beta.16",
"description": "2D JavaScript/TypeScript physics engine for cross-platform HTML5 game development",
"homepage": "https://github.com/shakiba/planck.js",
"keywords": [
Expand Down
3 changes: 2 additions & 1 deletion src/dynamics/Body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,8 @@ export class Body {

// Update center of mass velocity.
matrix.diffVec2(shift, this.m_sweep.c, oldCenter);
matrix.crossNumVec2(this.m_linearVelocity, this.m_angularVelocity, shift);
matrix.crossNumVec2(temp, this.m_angularVelocity, shift);
matrix.addVec2(this.m_linearVelocity, temp);
}

/**
Expand Down

0 comments on commit 820f610

Please sign in to comment.