From 6784c5e0ed2f40392682395f0f455c9c5c53483f Mon Sep 17 00:00:00 2001 From: Jasper Palfree Date: Thu, 13 Nov 2014 21:23:30 -0500 Subject: [PATCH 1/7] fix for timestep rounding errors --- src/core/world.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/world.js b/src/core/world.js index 6aad31c4..5868d44d 100644 --- a/src/core/world.js +++ b/src/core/world.js @@ -413,7 +413,7 @@ if ( dt ){ - this._dt = dt; + this._dt = +dt.toPrecision(4); // only keep 4 decimal places of precision otherwise we get rounding errors // calculate the maximum jump in time over which to do iterations this._maxJump = dt * this.options.maxIPF; From f341f5344d1f8ee4066f2d6ec76382a0c003e56d Mon Sep 17 00:00:00 2001 From: Jasper Palfree Date: Thu, 13 Nov 2014 22:26:39 -0500 Subject: [PATCH 2/7] fix for pubsub priorities --- src/util/pubsub.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/pubsub.js b/src/util/pubsub.js index 0f9bf111..0e58b913 100644 --- a/src/util/pubsub.js +++ b/src/util/pubsub.js @@ -1,5 +1,7 @@ (function(){ + var defaultPriority = 1; + function getPriority( val ){ return val._priority_; } @@ -67,12 +69,12 @@ fn._bindfn_ = orig; fn._one_ = orig._one_; - } else if (!priority) { + } else if ( priority === undefined ) { priority = scope; } - fn._priority_ = priority; + fn._priority_ = priority === undefined ? defaultPriority : priority; idx = Physics.util.sortedIndex( listeners, fn, getPriority ); From ac4b13c7e5d1d61a07b0e10bf2128bdf97740be6 Mon Sep 17 00:00:00 2001 From: Jasper Palfree Date: Thu, 13 Nov 2014 23:23:29 -0500 Subject: [PATCH 3/7] fix for #76 polygon collision detection contact points were being reported incorrectly --- src/behaviors/body-collision-detection.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/behaviors/body-collision-detection.js b/src/behaviors/body-collision-detection.js index fb026d99..991539c6 100644 --- a/src/behaviors/body-collision-detection.js +++ b/src/behaviors/body-collision-detection.js @@ -143,13 +143,18 @@ Physics.behavior('body-collision-detection', function( parent ){ } // calc overlap - overlap = Math.max(0, (support.marginA + support.marginB) - result.distance); + overlap = (support.marginA + support.marginB) - result.distance; + + if ( overlap <= 0 ){ + return scratch.done(false); + } + collision.overlap = overlap; // @TODO: for now, just let the normal be the mtv collision.norm = d.clone( result.closest.b ).vsub( tmp.clone( result.closest.a ) ).normalize().values(); collision.mtv = d.mult( overlap ).values(); // get a corresponding hull point for one of the core points.. relative to body A - collision.pos = d.clone( collision.norm ).mult( support.margin ).vadd( tmp.clone( result.closest.a ) ).vsub( bodyA.state.pos ).values(); + collision.pos = d.clone( collision.norm ).mult( support.marginA ).vadd( tmp.clone( result.closest.a ) ).vsub( bodyA.state.pos ).values(); } return scratch.done( collision ); From 2e062a0c069fb7b4056c3aa742931ac2d940bac0 Mon Sep 17 00:00:00 2001 From: Jasper Palfree Date: Thu, 13 Nov 2014 23:23:29 -0500 Subject: [PATCH 4/7] fix sweep-prune not resetting between steps --- src/behaviors/sweep-prune.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/behaviors/sweep-prune.js b/src/behaviors/sweep-prune.js index 7612a0df..30778368 100644 --- a/src/behaviors/sweep-prune.js +++ b/src/behaviors/sweep-prune.js @@ -196,6 +196,10 @@ Physics.behavior('sweep-prune', function( parent ){ }; } + if ( doCreate){ + c.flag = 1; + } + return c; }, @@ -315,10 +319,6 @@ Physics.behavior('sweep-prune', function( parent ){ if ( c ){ - if ( c.flag > collisionFlag ){ - c.flag = 1; - } - // if it's greater than the axis index, set the flag // to = 0. // if not, increment the flag by one. From 2f3fa43a55437a280fe80f8483f0cfac24fec873 Mon Sep 17 00:00:00 2001 From: Jasper Palfree Date: Fri, 14 Nov 2014 16:31:12 -0500 Subject: [PATCH 5/7] fix re #76. sweep prune had wrong aabb dims --- src/behaviors/sweep-prune.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/behaviors/sweep-prune.js b/src/behaviors/sweep-prune.js index 30778368..40e7e022 100644 --- a/src/behaviors/sweep-prune.js +++ b/src/behaviors/sweep-prune.js @@ -360,10 +360,7 @@ Physics.behavior('sweep-prune', function( parent ){ var tr ,intr - ,scratch = Physics.scratchpad() - ,pos = scratch.vector() ,aabb - ,span = scratch.vector() ,list = this.tracked ,i = list.length ; @@ -373,17 +370,13 @@ Physics.behavior('sweep-prune', function( parent ){ tr = list[ i ]; intr = tr.interval; - pos.clone( tr.body.state.pos ); aabb = tr.body.aabb(); - span.set( aabb.hw, aabb.hh ); // copy the position (plus or minus) the aabb half-dimensions // into the min/max intervals - intr.min.val.clone( pos ).vsub( span ); - intr.max.val.clone( pos ).vadd( span ); + intr.min.val.clone( aabb ).sub( aabb.hw, aabb.hh ); + intr.max.val.clone( aabb ).add( aabb.hw, aabb.hh ); } - - scratch.done(); }, /** internal From e6d01beee85afdd9786bba1065639795ab995dcd Mon Sep 17 00:00:00 2001 From: Jasper Date: Sun, 27 Mar 2016 12:48:07 -0400 Subject: [PATCH 6/7] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 140de59c..b5c56458 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ A modular, extendable, and easy-to-use physics engine for javascript. Latest version: 0.7.0 (beta) + **Looking for help!** If you would like to help maintain PhysicsJS, please contact me at jasper@wellcaffeinated.net + + Required Experience: + * Experience with numerical physics simulation + * Experience maintaining an open source javascript project + ## Usage **Please [visit the website](http://wellcaffeinated.net/PhysicsJS/) for From b9eca1634b6db222571e7e820a09404513fe2e46 Mon Sep 17 00:00:00 2001 From: Jasper Date: Wed, 30 May 2018 12:12:02 -0400 Subject: [PATCH 7/7] Update README.md --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b5c56458..b88f3fef 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ +# This project is no longer maintained + +It's been many years since writing this library. And I don't have time to dedicate to maintain it. On the up side, [Matter.js](http://brm.io/matter-js) has really stepped up and taken the spotlight of javascript physics. It has everything PhysicsJS has and more. :) + # PhysicsJS A modular, extendable, and easy-to-use physics engine for javascript. Latest version: 0.7.0 (beta) - **Looking for help!** If you would like to help maintain PhysicsJS, please contact me at jasper@wellcaffeinated.net - - Required Experience: - * Experience with numerical physics simulation - * Experience maintaining an open source javascript project - ## Usage **Please [visit the website](http://wellcaffeinated.net/PhysicsJS/) for