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

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

Introduction

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

Prototype

public BoundingBox() 

Source Link

Document

Constructs a new bounding box with the minimum and maximum vector set to zeros.

Usage

From source file:br.com.raphaelbruno.game.zombieinvaders.vr.model.GameObject.java

License:Apache License

public GameObject(ScreenBase context, Model model, BoundingBox bounds) {
    super(model);
    this.context = context;
    this.customBounds = bounds;

    this.bounds = this.customBounds != null ? this.customBounds : new BoundingBox();
    this.center = new Vector3();
    this.enabled = true;
    updateBox();//from   w  w  w . j a v  a  2 s.c o  m

    this.animations = new AnimationController(this);
    this.blending = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    for (Material item : materials) {
        item.set(new DepthTestAttribute(GL20.GL_LEQUAL, 0.01f, 25f, true));
        item.set(FloatAttribute.createAlphaTest(0.01f));
        item.set(blending);
    }
}

From source file:com.badlogic.gdx.ai.tests.utils.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);
    final Vector3 dimensions = boundingBox.getDimensions();
    create(model, mass, dimensions.x, dimensions.y, dimensions.z);
}

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.caresilabs.ase.models.GameObject.java

License:Apache License

public GameObject(String name, float x, float y, float z) {
    this.name = name;
    this.bounds = new BoundingBox();
    this.setPosition(x, y, z);
    this.setRotation(0, 0, 0);
}

From source file:com.github.fauu.helix.core.GeometrySet.java

License:Open Source License

public BoundingBox getGeometryBoundingBox(int id) {
    final BoundingBox boundingBox = new BoundingBox();

    geometries[id].getModel().calculateBoundingBox(boundingBox);

    return boundingBox;
}

From source file:com.github.fauu.helix.editor.World.java

License:Open Source License

private Object matchHoveredObject(int screenX, int screenY) {
    final Ray ray = camera.getPickRay(screenX, screenY);
    final Array<Object> objects = mapRegion.getObjects();
    Object matchedObject = null;//from  ww  w.  j a va  2  s  .co  m

    for (Object object : objects) {
        final BoundingBox boundingBox = new BoundingBox();
        object.getModelInstance().calculateBoundingBox(boundingBox);
        final Matrix4 transformationMatrix = new Matrix4();
        transformationMatrix
                .translate(new Vector3(2f + object.getPosition().x, 0, 0.5f + object.getPosition().y));
        boundingBox.mul(transformationMatrix);

        if (Intersector.intersectRayBoundsFast(ray, boundingBox)) {
            matchedObject = object;

            break;
        }
    }

    return matchedObject;
}

From source file:com.github.fauu.helix.graphics.ParticleEffect.java

License:Apache License

/** Returns the bounding box for all active particles. z axis will always be zero. */
public BoundingBox getBoundingBox() {
    if (bounds == null)
        bounds = new BoundingBox();

    BoundingBox bounds = this.bounds;
    bounds.inf();/*ww w  . ja  va 2 s  .  c  o m*/
    for (ParticleEmitter emitter : this.emitters)
        bounds.ext(emitter.getBoundingBox());
    return bounds;
}

From source file:com.github.fauu.helix.graphics.ParticleEmitter.java

License:Apache License

/** Returns the bounding box for all active particles. z axis will always be zero. */
public BoundingBox getBoundingBox() {
    if (bounds == null)
        bounds = new BoundingBox();

    Particle[] particles = this.particles;
    boolean[] active = this.active;
    BoundingBox bounds = this.bounds;

    bounds.inf();//from  ww w .  ja v  a 2 s .  c o m
    for (int i = 0, n = active.length; i < n; i++)
        if (active[i]) {
            Rectangle r = particles[i].getBoundingRectangle();
            bounds.ext(r.x, r.y, 0);
            bounds.ext(r.x + r.width, r.y + r.height, 0);
        }

    return bounds;
}

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

License:Apache License

@Inject
public ParticleEffectActor() {
    screenBoundingBox = new BoundingBox();
}

From source file:com.shansown.game.tests.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);
    Vector3 dimensions = new Vector3();
    boundingBox.getDimensions(dimensions);
    create(model, mass, dimensions.x, dimensions.y, dimensions.z);
}