title: How to properly apply torque or angular impulse to body in PlayN?
body: <p>I've been trying to apply an angular impulse to a Body object in PlayN, but to no avail. Whichever value (radials) I enter, the angle of the body never changes. I have tried to set the torque as well with no results.</p>
  
  <p><strong>Example code that doesn't work:</strong></p>
  
  <pre><code>BodyDef def = new BodyDef();
  def.type = BodyType.DYNAMIC;
  Body body = world.createBody(def);
  
  float degToRad = (float) (180 / Math.PI);
  float radials = (float) (50 / degToRad);
  
  // None of the following options work.
  body.applyAngularImpulse(radials);       // Immediate angular change.
  body.applyTorque(radials);               // Angular change over time.
  </code></pre>
  
  <p><strong>How can I get a valid body object to change its angle without manually setting its angular velocity (e.g. with setAngularVelocity)?</strong></p>
  
  <p>Thanks in advance!</p>
  
  <p>I did notice that the torque and angular velocity are reset by calling the setWake method, which I never do manually, but it is invoked by the Island class:</p>
  
  <pre><code>public void setAwake(boolean flag) {
      ...
      m_angularVelocity = 0.0f;
      m_torque = 0.0f;
      ...
  }
  </code></pre>
  
  <p><strong>Note:</strong> Setting the angular velocity is not an option because I rely on the physics simulation. I've found an <a href="http://www.iforce2d.net/b2dtut/rotate-to-angle" rel="nofollow">article for Box2D angle rotation</a>, but it didn't change the outcome of the applyAngularImpulse method.</p>