File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -672,16 +672,16 @@ var Axes = require('../geometry/Axes');
672672
673673 // sum the properties of all compound parts of the parent body
674674 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 ;
677679 properties . area += part . area ;
678680 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 ) ) ;
681682 }
682683
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 ) ;
685685
686686 return properties ;
687687 } ;
You can’t perform that action at this time.
0 commit comments