Apply some torque to it so it spins.

master
Zed A. Shaw 7 months ago
parent 084a9c59a6
commit ae93ac52b8
  1. 2
      sfmldemo/main.cpp

@ -137,9 +137,11 @@ int main() {
if(sf::Mouse::isButtonPressed(sf::Mouse::Left)) { if(sf::Mouse::isButtonPressed(sf::Mouse::Left)) {
b2Vec2 force(-200, 1000); b2Vec2 force(-200, 1000);
box.body->ApplyForceToCenter(force, true); box.body->ApplyForceToCenter(force, true);
box.body->ApplyTorque(100.0f, true);
} else if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) { } else if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) {
b2Vec2 force(200, 1000); b2Vec2 force(200, 1000);
box.body->ApplyForceToCenter(force, true); box.body->ApplyForceToCenter(force, true);
box.body->ApplyTorque(-100.0f, true);
} }
break; break;
} }

Loading…
Cancel
Save