File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ var MatterImage = new Class({
1616 Components . Force ,
1717 Components . Friction ,
1818 Components . Gravity ,
19+ Components . Inertia ,
1920 Components . Mass ,
2021 Components . Sensor ,
2122 Components . SetBody ,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ var MatterSprite = new Class({
1717 Components . Force ,
1818 Components . Friction ,
1919 Components . Gravity ,
20+ Components . Inertia ,
2021 Components . Mass ,
2122 Components . Sensor ,
2223 Components . SetBody ,
Original file line number Diff line number Diff line change 1+ var Body = require ( '../lib/body/Body' ) ;
2+
3+ var Inertia = {
4+
5+ setInertia : function ( value )
6+ {
7+ Body . setInertia ( this . body , value ) ;
8+
9+ return this ;
10+ } ,
11+
12+ // Useful to prevent rotation on body, e.g. for player in a platformer
13+ setMaxInertia : function ( )
14+ {
15+ Body . setInertia ( this . body , Number . POSITIVE_INFINITY ) ;
16+
17+ return this ;
18+ }
19+ } ;
20+
21+ module . exports = Inertia ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module.exports = {
77 Force : require ( './Force' ) ,
88 Friction : require ( './Friction' ) ,
99 Gravity : require ( './Gravity' ) ,
10+ Inertia : require ( './Inertia' ) ,
1011 Mass : require ( './Mass' ) ,
1112 Static : require ( './Static' ) ,
1213 Sensor : require ( './Sensor' ) ,
You can’t perform that action at this time.
0 commit comments