Example usage for com.badlogic.gdx.physics.box2d Body applyTorque

List of usage examples for com.badlogic.gdx.physics.box2d Body applyTorque

Introduction

In this page you can find the example usage for com.badlogic.gdx.physics.box2d Body applyTorque.

Prototype

public void applyTorque(float torque, boolean wake) 

Source Link

Document

Apply a torque.

Usage

From source file:com.stercore.code.net.dermetfan.utils.libgdx.box2d.Autopilot.java

License:Apache License

/** @param wake if the body should be woken up if its sleeping
 *  @see #calculateTorque(Vector2, float, float, float, float, float) */
public void rotate(Body body, Vector2 target, float angle, float force, float delta, boolean wake) {
    body.applyTorque(
            calculateTorque(rotateRelative ? target : vec2_0.set(positionAccessor.apply(body)).sub(target),
                    body.getTransform().getRotation() + angle, body.getAngularVelocity(), body.getInertia(),
                    adaptForceToMass ? force * body.getMass() : force, delta),
            wake);/*from   ww w.ja  v a  2  s  .c o  m*/
}

From source file:net.dermetfan.utils.libgdx.box2d.Autopilot.java

License:Apache License

/** @param wake if the body should be woken up if its sleeping
 *  @see #calculateTorque(Vector2, float, float, float, float, float) */
public void rotate(Body body, Vector2 target, float angle, float force, float delta, boolean wake) {
    body.applyTorque(
            calculateTorque(rotateRelative ? target : vec2_0.set(positionAccessor.access(body)).sub(target),
                    body.getTransform().getRotation() + angle, body.getAngularVelocity(), body.getInertia(),
                    adaptForceToMass ? force * body.getMass() : force, delta),
            wake);// w  ww.  j  a  va2  s .c o m
}