File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -672,16 +672,16 @@ var Axes = require('../geometry/Axes');
672
672
673
673
// sum the properties of all compound parts of the parent body
674
674
for ( var i = body . parts . length === 1 ? 0 : 1 ; i < body . parts . length ; i ++ ) {
675
- var part = body . parts [ i ] ;
676
- properties . mass += part . mass ;
675
+ var part = body . parts [ i ] ,
676
+ mass = part . mass !== Infinity ? part . mass : 1 ;
677
+
678
+ properties . mass += mass ;
677
679
properties . area += part . area ;
678
680
properties . inertia += part . inertia ;
679
- properties . centre = Vector . add ( properties . centre ,
680
- Vector . mult ( part . position , part . mass !== Infinity ? part . mass : 1 ) ) ;
681
+ properties . centre = Vector . add ( properties . centre , Vector . mult ( part . position , mass ) ) ;
681
682
}
682
683
683
- properties . centre = Vector . div ( properties . centre ,
684
- properties . mass !== Infinity ? properties . mass : body . parts . length ) ;
684
+ properties . centre = Vector . div ( properties . centre , properties . mass ) ;
685
685
686
686
return properties ;
687
687
} ;
You can’t perform that action at this time.
0 commit comments