File tree 1 file changed +2
-14
lines changed
1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -373,10 +373,6 @@ function Body(options){
373
373
374
374
this . concavePath = null ;
375
375
376
- this . lastDampingScale = 1 ;
377
- this . lastAngularDampingScale = 1 ;
378
- this . lastDampingTimeStep = - 1 ;
379
-
380
376
this . _wakeUpAfterNarrowphase = false ;
381
377
382
378
this . updateMassProperties ( ) ;
@@ -799,17 +795,9 @@ Body.prototype.addConstraintVelocity = function(){
799
795
*/
800
796
Body . prototype . applyDamping = function ( dt ) {
801
797
if ( this . type === Body . DYNAMIC ) { // Only for dynamic bodies
802
-
803
- // Since Math.pow generates garbage we check if we can reuse the scaling coefficient from last step
804
- if ( dt !== this . lastDampingTimeStep ) {
805
- this . lastDampingScale = Math . pow ( 1.0 - this . damping , dt ) ;
806
- this . lastAngularDampingScale = Math . pow ( 1.0 - this . angularDamping , dt ) ;
807
- this . lastDampingTimeStep = dt ;
808
- }
809
-
810
798
var v = this . velocity ;
811
- vec2 . scale ( v , v , this . lastDampingScale ) ;
812
- this . angularVelocity *= this . lastAngularDampingScale ;
799
+ vec2 . scale ( v , v , Math . pow ( 1.0 - this . damping , dt ) ) ;
800
+ this . angularVelocity *= Math . pow ( 1.0 - this . angularDamping , dt ) ;
813
801
}
814
802
} ;
815
803
You can’t perform that action at this time.
0 commit comments