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

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

Introduction

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

Prototype

public Vector2 getWorldPoint(Vector2 localPoint) 

Source Link

Document

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

Usage

From source file:com.pastew.autogearbox.handlers.Box2DSprite.java

License:Apache License

/** draws this {@link Box2DSprite} on the given {@link Body} */
public void draw(Batch batch, Body body) {
    float width = width(body), height = height(body);
    vec2.set(minX(body) + width / 2, minY(body) + height / 2);
    vec2.set(body.getWorldPoint(vec2));
    draw(batch, vec2.x, vec2.y, width, height, body.getAngle());
}

From source file:com.stercore.code.net.dermetfan.utils.libgdx.graphics.Box2DSprite.java

License:Apache License

/** draws this {@link Box2DSprite} on the given {@link Body} */
public void draw(Batch batch, Body body) {
    batch.setColor(getColor());//ww  w . j  a  v a 2  s.c o m
    float width = width(body), height = height(body);
    vec2.set(minX(body) + width / 2, minY(body) + height / 2);
    vec2.set(body.getWorldPoint(vec2));
    draw(batch, vec2.x, vec2.y, width, height, body.getAngle());
}