Example usage for com.badlogic.gdx.math.collision BoundingBox getWidth

List of usage examples for com.badlogic.gdx.math.collision BoundingBox getWidth

Introduction

In this page you can find the example usage for com.badlogic.gdx.math.collision BoundingBox getWidth.

Prototype

public float getWidth() 

Source Link

Usage

From source file:com.andgate.ikou.render.FloorRender.java

License:Open Source License

private void calculateSize() {
    size.x = 0;/*w  ww .  ja va 2s. c  om*/
    size.y = 0;
    size.z = 0;

    for (SectorMesh[] sectorMeshRow : sectorMeshes) {
        for (SectorMesh sectorMesh : sectorMeshRow) {
            Mesh mesh = sectorMesh.getMesh();

            if (mesh != null) {
                BoundingBox bbox = mesh.calculateBoundingBox();

                size.x += bbox.getWidth();
                size.y = Math.max(size.y, bbox.getHeight());
                size.z += bbox.getDepth();
            }
        }
    }
}

From source file:com.badlogic.gdx.tests.dragome.examples.bullet.BulletConstructor.java

License:Apache License

/** Creates a btBoxShape with the same dimensions as the shape. */
public BulletConstructor(final Model model, final float mass) {
    final BoundingBox boundingBox = new BoundingBox();
    model.calculateBoundingBox(boundingBox);
    create(model, mass, boundingBox.getWidth(), boundingBox.getHeight(), boundingBox.getDepth());
}

From source file:com.quadbits.gdxhelper.actors.ParticleEffectActor.java

License:Apache License

@Override
public void drawDebug(ShapeRenderer shapes) {
    super.drawDebug(shapes);

    if (!this.getDebug() || effect == null)
        return;//from  www.  j av a  2 s  .c om
    shapes.set(ShapeRenderer.ShapeType.Line);
    shapes.setColor(getStage().getDebugColor());
    BoundingBox boundingBox = effect.getBoundingBox();
    float centerX = boundingBox.getCenterX();
    float centerY = boundingBox.getCenterY();
    float width = boundingBox.getWidth();
    float height = boundingBox.getHeight();
    shapes.rect(centerX - width / 2, centerY - height / 2, width, height);
}