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

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

Introduction

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

Prototype

public Vector2 getWorldVector(Vector2 localVector) 

Source Link

Document

Get the world coordinates of a vector given the local coordinates.

Usage

From source file:com.agateau.pixelwheels.utils.Box2DUtils.java

License:Open Source License

@SuppressWarnings("unused")
public static Vector2 getForwardVelocity(Body body) {
    Vector2 currentRightNormal = body.getWorldVector(FORWARD_VECTOR);
    float v = currentRightNormal.dot(body.getLinearVelocity());
    return currentRightNormal.scl(v);
}

From source file:com.agateau.pixelwheels.utils.Box2DUtils.java

License:Open Source License

public static Vector2 getLateralVelocity(Body body) {
    Vector2 currentRightNormal = body.getWorldVector(LATERAL_VECTOR);
    float v = currentRightNormal.dot(body.getLinearVelocity());
    return currentRightNormal.scl(v);
}