File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
tests/tests/classes/tests/Box2DTestBet(Box2D)/Tests Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -132,18 +132,35 @@ public ApplyForce()
132132 }
133133 }
134134
135+ private bool _ApplyToCenter = false ;
136+
135137 public override void Keyboard ( char key )
136138 {
137139 switch ( key )
138140 {
141+ case 'c' :
142+ _ApplyToCenter = ! _ApplyToCenter ;
143+ break ;
139144 case 'w' :
140145 {
141146 b2Vec2 f = m_body . GetWorldVector ( new b2Vec2 ( 0.0f , - 200.0f ) ) ;
142147 b2Vec2 p = m_body . GetWorldPoint ( new b2Vec2 ( 0.0f , 2.0f ) ) ;
143- m_body . ApplyForce ( f , p ) ;
148+ if ( _ApplyToCenter )
149+ m_body . ApplyForceToCenter ( f ) ;
150+ else
151+ m_body . ApplyForce ( f , p ) ;
152+ }
153+ break ;
154+ case 'x' :
155+ {
156+ b2Vec2 f = m_body . GetWorldVector ( new b2Vec2 ( 0.0f , 200.0f ) ) ;
157+ b2Vec2 p = m_body . GetWorldPoint ( new b2Vec2 ( 0.0f , 2.0f ) ) ;
158+ if ( _ApplyToCenter )
159+ m_body . ApplyForceToCenter ( f ) ;
160+ else
161+ m_body . ApplyForce ( f , p ) ;
144162 }
145163 break ;
146-
147164 case 'a' :
148165 {
149166 m_body . ApplyTorque ( 50.0f ) ;
You can’t perform that action at this time.
0 commit comments