Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final int size = physics.boxes.size;
- for (int i = 0; i < size; ++i) {
- final Body box = physics.boxes.items[i];
- final int index = (Integer) box.getUserData();
- batch.setColor(colors[index]);
- final Vector2 position = box.getPosition();
- final float angleRad = box.getAngle();
- final float cos = MathUtils.cos(angleRad);
- final float sin = MathUtils.sin(angleRad);
- final float angle = MathUtils.radiansToDegrees * angleRad;
- final ArrayList<Fixture> tmpFixList = box.getFixtureList();
- final int fixSize = tmpFixList.size();
- for (int j = 0; j < fixSize; ++j) {
- final Vector2 tmpPos = (Vector2) tmpFixList.get(j)
- .getUserData();
- final float tmpX = tmpPos.x;
- final float tmpY = tmpPos.y;
- final float newX = tmpX * cos - tmpY * sin
- - Data.BLOCK_SIZE + position.x;
- final float newY = tmpX * sin + tmpY * cos
- - Data.BLOCK_SIZE + position.y;
- batch.draw(textureRegion, newX, newY, 1f, 1f, 2f, 2f, 1f,
- 1f, angle);
- }
- }
Add Comment
Please, Sign In to add comment